Subscriptions - Create Or Update
创建主题订阅。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}?api-version=2024-01-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
namespace
|
path | True |
string minLength: 6maxLength: 50 |
命名空间名称 |
resource
|
path | True |
string minLength: 1maxLength: 90 |
资源组的名称。 名称不区分大小写。 |
subscription
|
path | True |
string |
唯一标识Microsoft Azure 订阅的订阅凭据。 订阅 ID 构成了每个服务调用的 URI 的一部分。 |
subscription
|
path | True |
string minLength: 1maxLength: 50 |
订阅名称。 |
topic
|
path | True |
string minLength: 1 |
主题名称。 |
api-version
|
query | True |
string minLength: 1 |
用于此操作的 API 版本。 |
请求正文
名称 | 类型 | 说明 |
---|---|---|
properties.autoDeleteOnIdle |
string (duration) |
ISO 8061 timeSpan 空闲间隔之后,主题会自动删除。 最短持续时间为 5 分钟。 |
properties.clientAffineProperties |
特定于客户端 affine 订阅的属性。 |
|
properties.deadLetteringOnFilterEvaluationExceptions |
boolean |
指示订阅是否对筛选器评估异常具有死信支持的值。 |
properties.deadLetteringOnMessageExpiration |
boolean |
指示消息过期时订阅是否具有死信支持的值。 |
properties.defaultMessageTimeToLive |
string (duration) |
ISO 8061 默认消息时间跨度为实时值。 这是消息过期的持续时间,从消息发送到服务总线时开始。 这是未在消息本身上设置 TimeToLive 时使用的默认值。 |
properties.duplicateDetectionHistoryTimeWindow |
string (duration) |
定义重复检测历史记录持续时间的 ISO 8601 timeSpan 结构。 默认值为 10 分钟。 |
properties.enableBatchedOperations |
boolean |
指示是否启用服务器端批处理作的值。 |
properties.forwardDeadLetteredMessagesTo |
string |
用于转发死信消息的队列/主题名称 |
properties.forwardTo |
string |
用于转发消息的队列/主题名称 |
properties.isClientAffine |
boolean |
指示订阅是否具有客户端 ID 的相关性的值。 |
properties.lockDuration |
string (duration) |
订阅的 ISO 8061 锁定持续时间时间跨度。 默认值为 1 分钟。 |
properties.maxDeliveryCount |
integer (int32) |
最大交付次数。 |
properties.requiresSession |
boolean |
指示订阅是否支持会话概念的值。 |
properties.status |
枚举消息实体状态的可能值。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
已接受订阅创建请求。 |
|
Other Status Codes |
描述作失败的原因的 ServiceBus 错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
SubscriptionCreate
示例请求
PUT https://management.azure.com/subscriptions/Subscriptionid/resourceGroups/ResourceGroup/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1349/topics/sdk-Topics-8740/subscriptions/sdk-Subscriptions-2178?api-version=2024-01-01
{
"properties": {
"enableBatchedOperations": true
}
}
示例响应
{
"id": "/subscriptions/Subscriptionid/resourceGroups/ResourceGroup/providers/Microsoft.ServiceBus/namespaces/sdk-Namespace-1349/topics/sdk-Topics-8740/subscriptions/sdk-Subscriptions-2178",
"name": "sdk-Subscriptions-2178",
"type": "Microsoft.ServiceBus/Namespaces/Topics/Subscriptions",
"properties": {
"lockDuration": "PT1M",
"requiresSession": false,
"defaultMessageTimeToLive": "P10675199DT2H48M5.4775807S",
"deadLetteringOnMessageExpiration": true,
"deadLetteringOnFilterEvaluationExceptions": true,
"messageCount": 0,
"maxDeliveryCount": 10,
"status": "Active",
"enableBatchedOperations": true,
"createdAt": "2021-01-04T18:02:20.5992764Z",
"updatedAt": "2021-01-04T18:02:20.5992764Z",
"accessedAt": "2021-01-04T18:02:20.5992764Z",
"countDetails": {
"activeMessageCount": 0,
"deadLetterMessageCount": 0,
"scheduledMessageCount": 0,
"transferMessageCount": 0,
"transferDeadLetterMessageCount": 0
},
"autoDeleteOnIdle": "P10675199DT2H48M5.4775807S",
"forwardTo": "sdk-Topics-3065",
"forwardDeadLetteredMessagesTo": "sdk-Topics-3065"
}
}
定义
名称 | 说明 |
---|---|
created |
创建资源的标识的类型。 |
Entity |
实体状态。 |
Error |
错误对象。 |
Error |
资源管理错误附加信息。 |
Error |
资源管理错误响应。 |
Message |
消息计数详细信息。 |
SBClient |
特定于客户端 affine 订阅的属性。 |
SBSubscription |
订阅资源的说明。 |
system |
与创建和上次修改资源相关的元数据。 |
createdByType
创建资源的标识的类型。
值 | 说明 |
---|---|
Application | |
Key | |
ManagedIdentity | |
User |
EntityStatus
实体状态。
值 | 说明 |
---|---|
Active | |
Creating | |
Deleting | |
Disabled | |
ReceiveDisabled | |
Renaming | |
Restoring | |
SendDisabled | |
Unknown |
Error
错误对象。
名称 | 类型 | 说明 |
---|---|---|
additionalInfo |
错误附加信息。 |
|
code |
string |
错误代码。 |
details |
错误详细信息。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
ErrorAdditionalInfo
资源管理错误附加信息。
名称 | 类型 | 说明 |
---|---|---|
info |
object |
其他信息。 |
type |
string |
其他信息类型。 |
ErrorResponse
资源管理错误响应。
名称 | 类型 | 说明 |
---|---|---|
error |
错误对象。 |
MessageCountDetails
消息计数详细信息。
名称 | 类型 | 说明 |
---|---|---|
activeMessageCount |
integer (int64) |
队列、主题或订阅中的活动消息数。 |
deadLetterMessageCount |
integer (int64) |
死信的消息数。 |
scheduledMessageCount |
integer (int64) |
计划消息数。 |
transferDeadLetterMessageCount |
integer (int64) |
传输到死信的消息数。 |
transferMessageCount |
integer (int64) |
传输到另一个队列、主题或订阅的消息数。 |
SBClientAffineProperties
特定于客户端 affine 订阅的属性。
名称 | 类型 | 说明 |
---|---|---|
clientId |
string |
指示创建客户端-affine 订阅的应用程序的客户端 ID。 |
isDurable |
boolean |
对于客户端-affine 订阅,此值指示订阅是否持久。 |
isShared |
boolean |
对于客户端-affine 订阅,此值指示是否共享订阅。 |
SBSubscription
订阅资源的说明。
名称 | 类型 | 说明 |
---|---|---|
id |
string |
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
location |
string |
资源所在的地理位置 |
name |
string |
资源的名称 |
properties.accessedAt |
string (date-time) |
上次有此订阅的接收请求。 |
properties.autoDeleteOnIdle |
string (duration) |
ISO 8061 timeSpan 空闲间隔之后,主题会自动删除。 最短持续时间为 5 分钟。 |
properties.clientAffineProperties |
特定于客户端 affine 订阅的属性。 |
|
properties.countDetails |
消息计数详细信息 |
|
properties.createdAt |
string (date-time) |
创建消息的确切时间。 |
properties.deadLetteringOnFilterEvaluationExceptions |
boolean |
指示订阅是否对筛选器评估异常具有死信支持的值。 |
properties.deadLetteringOnMessageExpiration |
boolean |
指示消息过期时订阅是否具有死信支持的值。 |
properties.defaultMessageTimeToLive |
string (duration) |
ISO 8061 默认消息时间跨度为实时值。 这是消息过期的持续时间,从消息发送到服务总线时开始。 这是未在消息本身上设置 TimeToLive 时使用的默认值。 |
properties.duplicateDetectionHistoryTimeWindow |
string (duration) |
定义重复检测历史记录持续时间的 ISO 8601 timeSpan 结构。 默认值为 10 分钟。 |
properties.enableBatchedOperations |
boolean |
指示是否启用服务器端批处理作的值。 |
properties.forwardDeadLetteredMessagesTo |
string |
用于转发死信消息的队列/主题名称 |
properties.forwardTo |
string |
用于转发消息的队列/主题名称 |
properties.isClientAffine |
boolean |
指示订阅是否具有客户端 ID 的相关性的值。 |
properties.lockDuration |
string (duration) |
订阅的 ISO 8061 锁定持续时间时间跨度。 默认值为 1 分钟。 |
properties.maxDeliveryCount |
integer (int32) |
最大交付次数。 |
properties.messageCount |
integer (int64) |
消息数。 |
properties.requiresSession |
boolean |
指示订阅是否支持会话概念的值。 |
properties.status |
枚举消息实体状态的可能值。 |
|
properties.updatedAt |
string (date-time) |
消息的确切更新时间。 |
systemData |
与此资源相关的系统元数据。 |
|
type |
string |
资源的类型。 例如“Microsoft.EventHub/Namespaces”或“Microsoft.EventHub/Namespaces/EventHubs” |
systemData
与创建和上次修改资源相关的元数据。
名称 | 类型 | 说明 |
---|---|---|
createdAt |
string (date-time) |
资源创建时间戳(UTC)。 |
createdBy |
string |
创建资源的标识。 |
createdByType |
创建资源的标识的类型。 |
|
lastModifiedAt |
string (date-time) |
上次修改资源的标识的类型。 |
lastModifiedBy |
string |
上次修改资源的标识。 |
lastModifiedByType |
上次修改资源的标识的类型。 |