次の方法で共有


イベント ハブの作成

新しい Event Hub を作成します。 Event Hub を作成する際は、以下のプロパティを指定することができます。 プロパティが指定されていない場合、Event Hubs はこのプロパティの既定値を使用します。 「EventHubDescription のプロパティ」を参照してください

プロパティ

次に示すプロパティに加えて、イベント ハブの説明に表示されるが、サービスでは無視される追加のプロパティを指定できます。

プロパティは以下の順序で指定する必要があります。 正しい指定順序を逸脱したプロパティは、ユーザー プロパティと解釈されます。 このプロパティは、Event Hub の説明に 2 回表示されます。1 回はユーザーによって設定された値で、1 回は Event Hubs で使用される既定値で表示されます。

プロパティ名 次の API バージョン以降で利用可 Default [プロパティの説明]
MessageRetentionInDays 2014-01 0 説明
Authorization 2014-01 (空) 説明
Status 2014-01 アクティブ 説明
UserMetadata 2014-01 (空) 説明
PartitionCount 2014-01 16 説明

Request

Method 要求 URI HTTP バージョン
PUT https://{serviceNamespace}.servicebus.windows.net/{eventHubPath} HTTP/1.1

要求ヘッダー

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

要求本文

Atom エントリの内容に説明を埋め込みます。 次に例を示します。

<entry xmlns='http://www.w3.org/2005/Atom'>  
  <content type='application/xml'>  
    {EventHubDescription}  
  </content>  
</entry>  

[応答]

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

応答コード

コード 説明
201 Event Hub が作成された。
400 無効な要求です。
401 認証エラー。
403 クォータを超過。Event Hub は作成されません。
409 指定した Event Hub は既に存在する (または指定したパスは既に使用されている)。
500 内部エラーです。

応答本文

要求が成功した場合、応答本文には、作成されたイベント ハブの説明が含まれます。 要求が失敗すると、本文にエラー コードとエラー メッセージが追加されます。

使用例

Request

注意

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

PUT https://your-namespace.servicebus.windows.net/your-event-hub?timeout=60&api-version=2014-01 HTTP/1.1  
Authorization: SharedAccessSignature sr=your-namespace.servicebus.windows.net&sig=tYu8qdH563Pc96Lky0SFs5PhbGnljF7mLYQwCZmk9M0%3d&se=1403736877&skn=RootManageSharedAccessKey  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Host: your-namespace.servicebus.windows.net  
Content-Length: 264  
Expect: 100-continue  
Connection: Keep-Alive  
  
<entry xmlns='http://www.w3.org/2005/Atom'>  
  <content type='application/xml'>  
    <EventHubDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">  
    </EventHubDescription>  
  </content>  
</entry>  

Response

HTTP/1.1 201 Created  
Transfer-Encoding: chunked  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Server: Microsoft-HTTPAPI/2.0  
Date: Wed, 25 Jun 2014 22:43:27 GMT  
  
<entry xmlns="http://www.w3.org/2005/Atom">  
  <id>https://your-namespace.servicebus.windows.net/your-event-hub?timeout=60&api-version=2014-01</id>  
  <title type="text">your-event-hub</title>  
  <published>2014-06-25T22:43:16Z</published>  
  <updated>2014-06-25T22:43:27Z</updated>  
  <author>  
    <name>your-namespace</name>  
  </author>  
  <link rel="self" href="https://your-namespace.servicebus.windows.net/your-event-hub?timeout=60&api-version=2014-01"/>  
  <content type="application/xml">  
    <EventHubDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
      <MessageRetentionInDays>3</MessageRetentionInDays>   
      <SizeInBytes>0</SizeInBytes>  
      <AuthorizationRules></AuthorizationRules>  
      <Status>Active</Status>  
      <PartitionCount>16</PartitionCount>  
      <EntityAvailabilityStatus>Available</EntityAvailabilityStatus>  
    </EventHubDescription>  
  </content>  
</entry>  

次の HTTP 要求は、カスタムの設定で Event Hub を作成するものです。

PUT https://your-namespace.servicebus.windows.net/your-event-hub?timeout=60&api-version=2014-01 HTTP/1.1  
Authorization: SharedAccessSignature sr=your-namespace.servicebus.windows.net&sig=your-sas-key&se=1403736877&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'>  
    <EventHubDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">  
      <MessageRetentionInDays>3</MessageRetentionInDays>  
      <PartitionCount>8</PartitionCount>  
    </EventHubDescription>  
  </content>  
</entry>  
  

Event Hubs は、次の応答を返します。

HTTP/1.1 201 Created  
Transfer-Encoding: chunked  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Server: Microsoft-HTTPAPI/2.0  
Date: Wed, 25 Jun 2014 22:43:27 GMT  
  
<entry xmlns="http://www.w3.org/2005/Atom">  
  <id>https://your-namespace.servicebus.windows.net/your-event-hub?timeout=60&api-version=2014-01</id>  
  <title type="text">your-event-hub</title>  
  <published>2014-06-25T22:43:16Z</published>  
  <updated>2014-06-25T22:43:27Z</updated>  
  <author>  
    <name>your-namespace</name>  
  </author>  
  <link rel="self" href="https://your-namespace.servicebus.windows.net/your-event-hub?timeout=60&api-version=2014-01"/>  
  <content type="application/xml">  
    <EventHubDescription xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
      <MessageRetentionInDays>3</MessageRetentionInDays>   
      <SizeInBytes>0</SizeInBytes>  
      <AuthorizationRules></AuthorizationRules>  
      <Status>Active</Status>  
      <PartitionCount>16</PartitionCount>  
      <EntityAvailabilityStatus>Available</EntityAvailabilityStatus>  
    </EventHubDescription>  
  </content>  
</entry>