次の方法で共有


コンシューマー グループを作成する

新しいコンシューマー グループを作成します。 コンシューマー グループを作成するときに、 ConsumerGroupDescription で次のプロパティを指定できます。 プロパティが指定されていない場合、Event Hubs はそのプロパティの既定値を使用します。 「 ConsumerGroupDescription のプロパティ」を参照してください。

ConsumerGroupDescription プロパティの既定値:

プロパティ名 Default
UserMetadata (空)

Request

Method 要求 URI
PUT https://{servicebusNamespace}.servicebus.windows.net/{eventHubPath}/consumergroups/{consumergroupName}

要求ヘッダー

Event Hubs に関連するすべての要求で使用されるヘッダーとパラメーターについては、「 共通 のパラメーターとヘッダー」を参照してください。

Response

応答には、HTTP 状態コード、一連の応答ヘッダー、および応答本文が含まれています。

要素名 必須 Type Version 説明
CreatedAt はい、読み取り専用 string 2014-01 コンシューマー グループが作成された正確な時刻。
UpdatedAt はい、読み取り専用 string 2014-01 コンシューマー グループが更新された正確な時刻。

応答コード

コード 説明
201 作成されました。
400 無効な要求です。
401 認証エラー。
403 クォータを超えました。コンシューマー グループが作成されていません。
409 指定したコンシューマー グループは既に存在します (または、指定したパスが既に占有されています)。
500 内部エラーです。

応答本文

要求が成功した場合、応答本文には、指定されたコンシューマー グループの説明が含まれます。 要求が成功しない場合、本文にはエラー コードとエラー メッセージが含まれます。

Request

注意

また、「共通パラメーターとヘッダー」で説明されているように、Authorization ヘッダーに Azure Active Directory トークンを使用することもできます。 (例: Authorization: Bearer <Azure AD token>)。

PUT https://your-namespace.servicebus.windows.net/your-event-hub/consumergroups/testCG?timeout=60&api-version=2014-01 HTTP/1.1  
Authorization: SharedAccessSignature sr=https%3A%2F%2Fyour-namespace.servicebus.windows.net%2F&sig=your-sas-key&se=1455847106&skn=RootManageSharedAccessKey  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Host: your-namespace.servicebus.windows.net  
  
<entry xmlns="http://www.w3.org/2005/Atom">  
   <content type="application/xml">  
      <ConsumerGroupDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
      </ConsumerGroupDescription>  
   </content>  
</entry>  
  

Response

HTTP/1.1 201 Created  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Server: Microsoft-HTTPAPI/2.0  
Date: Fri, 19 Feb 2016 01:52:50 GMT  
Content-Length: 776  
  
<?xml version="1.0" encoding="UTF-8"?>  
<entry xmlns="http://www.w3.org/2005/Atom">  
   <id>https://your-namespace.servicebus.windows.net/your-event-hub/consumergroups/testCG?timeout=60&api-version=2014-01</id>  
   <title type="text">testCG</title>  
   <published>2016-02-19T01:52:50Z</published>  
   <updated>2016-02-19T01:52:50Z</updated>  
   <link rel="self" href="https://your-namespace.servicebus.windows.net/your-event-hub/consumergroups/testCG?timeout=60&api-version=2014-01" />  
   <content type="application/xml">  
      <ConsumerGroupDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
         <CreatedAt>2016-02-19T01:52:50.570652Z</CreatedAt>  
         <UpdatedAt>2016-02-19T01:52:50.570652Z</UpdatedAt>  
      </ConsumerGroupDescription>  
   </content>  
</entry>