快速入門:使用 Azure 入口網站建立 Azure 事件中樞結構描述登錄

Azure 結構描述登錄是事件中樞的一項功能,可為事件驅動和以訊息為中心的應用程式,提供結構描述的中央存放庫。 其可為您的生產者和取用者應用程式提供彈性以交換資料而不需要管理和共用結構描述。 其也為可重複使用的結構描述提供簡單的治理架構,並透過群組結構 (結構描述群組) 定義結構描述之間的關聯性。 如需詳細資訊,請參閱事件中樞中的 Azure 結構描述登錄

本文說明如何使用 Azure 事件中樞所裝載結構描述登錄中的結構描述,建立結構描述群組。

注意

  • 此功能不適用於基本層。
  • 請確定您是這些角色之一的成員:擁有者參與者結構描述登錄參與者。 如需角色型存取控制的詳細資訊,請參閱結構描述登錄概觀
  • 如果事件中樞位於虛擬網路中,除非您從相同虛擬網路中的 VM 存取入口網站,否則您將無法在 Azure 入口網站中建立結構描述。
  • 已啟用私人端點的命名空間不支援結構描述登錄功能。

必要條件

建立事件中樞命名空間。 您也可以使用現有的命名空間。

建立結構描述群組

  1. 瀏覽至 [事件中樞命名空間] 頁面。

  2. 在左側功能表上選取 [結構描述登錄]。 若要建立結構描述群組,請選取工具列上的 [+ 結構描述群組]

    Image showing the Schema Registry page in the Azure portal

  3. 在 [建立結構描述群組] 頁面上,執行下列步驟:

    1. 輸入結構描述群組的名稱

    2. 針對序列化類型,請選取適用於結構描述群組中所有結構描述的 Avro 序列化格式。 也支援 JSON 序列化格式(預覽)。

    3. 為群組中的所有結構描述選取相容性模式Avro 支援向前和回溯相容性模式。

    4. 然後,選取 [建立] 以建立結構描述群組。

      Image showing the page for creating a schema group

  4. 在結構描述群組清單中,選取結構描述群組的名稱。

    Image showing schema group in the list selected.

  5. 您會看到群組的 [結構描述群組] 頁面。

    Image showing the Schema Group page

將結構描述新增至結構描述群組

在本節中,您會使用 Azure 入口網站將結構描述新增至結構描述群組。

  1. 在 [結構描述群組] 頁面上,選取工具列上的 [+ 結構描述]

  2. 在 [建立結構描述] 頁面上,執行下列步驟:

    1. 對於名稱,輸入 orderschema

    2. 在文字方塊中輸入下列結構描述。 您也可以選取具有結構描述的檔案。

      {
        "namespace": "com.azure.schemaregistry.samples",
        "type": "record",
        "name": "Order",
        "fields": [
          {
            "name": "id",
            "type": "string"
          },
          {
            "name": "amount",
            "type": "double"
          }
        ]
      }
      
    3. 選取 建立

  3. 從結構描述清單中選取結構描述

    Image showing the schema selected.

  4. 您會看到結構描述的結構描述概觀頁面。

    Image showing the Schema Overview page.

  5. 如果有多個版本的結構描述,您會在 [版本] 下拉式清單中看到這些版本。 選取版本以切換至該版本結構描述。

建立新版本的結構描述

  1. 更新文字方塊中的結構描述,然後選取 [驗證]。 在下列範例中,已將新欄位 description 新增至結構描述。

    Image showing the Update schema page

  2. 檢閱驗證狀態和變更,然後選取 [儲存]

    Image showing the Review page that shows validation status, changes, and save

  3. 您會在 [結構描述概觀] 頁面上看到 [版本] 已選取為 2

    Image showing the new version of schema

  4. 選取 1 以查看結構描述的第 1 版。

清除資源

注意

如果您想要繼續進行後續步驟中連結的下一個快速入門,則請勿清除資源。

  1. 瀏覽至 [事件中樞命名空間] 頁面。
  2. 在左側功能表上選取 [結構描述登錄]
  3. 選取您在本快速入門中建立的結構描述群組
  4. 在 [結構描述群組] 頁面上,選取工具列上的 [刪除]
  5. 在 [刪除結構描述群組] 頁面上,輸入結構描述群組的名稱,然後選取 [刪除]

下一步