Creates an event stream.
URL
/eventstreaming/createEventStreaming
Usage notes
- In an event stream, only one of the SourceMNSParameters, SourceRocketMQParameters, SourceRabbitMQParameters, and SourceSLSParameters parameters can be returned.
- In an event stream, you can specify only one of the SinkMNSParameters, SinkRocketMQParameters, SinkRabbitMQParameters, and SinkSLSParameters parameters.
Request parameters
| Parameter | Type | Required | Example | Description |
| EventStreamingName | String | Yes | myeventstreaming | The name of the event stream. |
| Description | String | Yes | rocketmq2mns | The description of the event stream. |
| Source | Object | Yes | SourceRocketMQParameters | The event provider. |
| SourceMNSParameters | Object | No | Specifies that the event provider is Simple Message Queue (formerly MNS). For more information, see Request parameter SourceMNSParameters. | |
| SourceRocketMQParameters | Object | No | Specifies that the event provider is ApsaraMQ for RocketMQ. For more information, see Request parameter SourceRocketMQParameters. | |
| SourceRabbitMQParameters | Object | No | Specifies that the event provider is ApsaraMQ for RabbitMQ. For more information, see Request parameter SourceRabbitMQParameters. | |
| SourceSLSParameters | Object | No | Specifies that the event provider is Log Service. For more information, see Request parameter SinkSLSParameters. | |
| FilterPattern | String | No | None. | The rule that is used to filter events. If you leave this parameter empty, all events are matched. |
| Sink | Object | Yes | SinkMNSParameters | The event target. |
| SinkMNSParameters | Object | No | Specifies that the event target is Simple Message Queue (formerly MNS). For more information, see Request parameter SinkMNSParameters. | |
| SinkRocketMQParameters | Object | No | Specifies that the event target is ApsaraMQ for RocketMQ. For more information, see Request parameter SinkRocketMQParameters. | |
| SinkRabbitMQParameters | Object | No | Specifies that the event target is ApsaraMQ for RabbitMQ. For more information, see Request parameter SinkRabbitMQParameters. | |
| SinkSLSParameters | Object | No | Specifies that the event target is Log Service. For more information, see Request parameter SinkSLSParameters. | |
| RunOptions | Object | No | The runtime environment. | |
| RetryStrategy | String | Yes | BACKOFF_RETRY | The retry policy to be used when an event fails to be pushed. Valid values:
Default value: BACKOFF_RETRY. |
| ErrorsTolerance | String | Yes | ALL | The fault tolerance policy. The policy specifies whether to ignore an error when the error occurs. Valid values:
Default value: ALL. |
| DeadLetterQueue | Object | Yes | Specifies whether to enable dead-letter queues. By default, dead-letter queues are disabled. Messages that fail to be pushed after allowed retries as specified by the retry policy are discarded. | |
| Arn | String | No | acs:mq:cn-chengdu:164901546557****:/instances/MQ_INST_164901546557****_BXxk0KXx/topic/Mytopic | The Alibaba Cloud Resource Name (ARN) of the topic in the ApsaraMQ for RabbitMQ instance. |
Request parameter SourceMNSParameters
If you specify the SourceMNSParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| QueueName | String | Yes | demo | The name of the queue in the Simple Message Queue (formerly MNS) instance. |
| IsBase64Decode | String | Yes | true | Specifies whether to enable Base64 encoding. Default value: true. |
Request parameter SourceRocketMQParameters
If you specify the SourceRocketMQParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| RegionId | String | Yes | cn-hangzhou | The ID of the region where the ApsaraMQ for RocketMQ instance resides. |
| InstanceId | String | Yes | MQ_INST_164901546557****_BAAN**** | The ID of the ApsaraMQ for RocketMQ instance. For more information, see Limits. |
| Topic | String | Yes | mytopic | The name of the topic in the ApsaraMQ for RocketMQ instance. For more information, see Limits. |
| Tag | String | No | test | The tags that are used to filter messages. |
| Offset | String | No | CONSUME_FROM_TIMESTAMP | The consumer offset of messages. Valid values:
Default value: CONSUME_FROM_LAST_OFFSET. |
| Timestamp | Long | No | 1636597951964 | The timestamp of the offset from which consumption starts. This parameter is valid only when you set the Offset parameter to CONSUME_FROM_TIMESTAMP. |
| GroupID | String | Yes | GID_group1 | The ID of the group in the ApsaraMQ for RocketMQ instance. |
Request parameter SourceRabbitMQParameters
If you specify the SourceRabbitMQParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| InstanceId | String | Yes | amqp-cn-nif22u74**** | The ID of the ApsaraMQ for RabbitMQ instance. For more information, see Limits. |
| VirtualHostName | String | Yes | eb-connect | The name of the vhost in the ApsaraMQ for RabbitMQ instance. For more information, see Limits. |
| QueueName | String | Yes | demo | The name of the queue in the ApsaraMQ for RabbitMQ instance. For more information, see Limits. |
Request parameter SourceSLSParameters
If you specify the SourceMNSParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| Project | String | Yes | test-project | The Log Service project. |
| LogStore | String | Yes | test-logstore | The Log Service Logstore. |
| ConsumePosition | String | No | end | The starting consumer offset. The value begin indicates the earliest offset, and the value end indicates the latest offset. You can also specify a time in seconds to start consumption. |
| RoleName | String | Yes | testRole | The name of the role. If you want to authorize EventBridge to use this role to read the logs in Log Service, you must select Alibaba Cloud Service for the Selected Trusted Entity parameter, and select EventBridge for the Select Trusted Service parameter when you create the role in the RAM console. For information about the permission policy of this role, see Create a custom event source of the Simple Log Service type. |
Request parameter SinkMNSParameters
If you specify the SinkMNSParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| QueueName | TargetParameter | Yes | The name of the queue that you specify when the event target is Simple Message Queue (formerly MNS). | |
| Value | String | Yes | MyQueue | The name of the queue in the Simple Message Queue (formerly MNS) instance. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| Body | TargetParameter | No | The content of the message. | |
| Form | String | No | TEMPLATE | The transformation method. |
| Value | String | Yes | | The value before the transformation. |
| Template | String | No | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
| IsBase64Encode | TargetParameter | Yes | Specifies whether to enable Base64 encoding. | |
| Value | String | Yes | true | Enables Base64 encoding. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
Request parameter SinkRocketMQParameters
If you specify the SinkRocketMQParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| InstanceId | TargetParameter | Yes | The ID of the instance that you specify when the event target is ApsaraMQ for RocketMQ. | |
| Value | String | Yes | MQ_INST_164901546557****_BAAN**** | The ID of the ApsaraMQ for RocketMQ instance. For more information, see Limits. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| Topic | TargetParameter | Yes | The topic in the ApsaraMQ for RocketMQ instance. | |
| Value | String | Yes | Mytopic | The name of the topic in the ApsaraMQ for RocketMQ instance. For more information, see Limits. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| Body | TargetParameter | Yes | The content of the message. | |
| Form | String | No | No | TEMPLATE |
| Value | String | Yes | | The value before the transformation. |
| Template | String | Yes | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
| Properties | TargetParameter | Yes | The properties that are used to filter messages. | |
| Value | String | Yes | | The value before the transformation. |
| Form | String | No | TEMPLATE | The transformation method. |
| Template | String | Yes | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
| Keys | TargetParameter | Yes | The properties that are used to filter messages. | |
| Value | String | Yes | | The value before the transformation. |
| Form | String | No | TEMPLATE | The transformation method. |
| Template | String | Yes | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
| Tags | TargetParameter | Yes | The properties that are used to filter messages. | |
| Value | String | Yes | | The value before the transformation. |
| Form | String | No | TEMPLATE | The transformation method. |
| Template | String | Yes | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
Request parameter SinkRabbitMQParameters
If you specify the SinkRabbitMQParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| InstanceId | TargetParameter | Yes | The ID of the instance that you specify when the event target is ApsaraMQ for RabbitMQ. | |
| Value | String | Yes | amqp-cn-2r42e73o**** | The ID of the ApsaraMQ for RabbitMQ instance. For more information, see Limits. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| VirtualHostName | TargetParameter | Yes | The name of the vhost in the ApsaraMQ for RabbitMQ instance. | |
| Value | String | Yes | rabbit-host | The name of the vhost in the ApsaraMQ for RabbitMQ instance. For more information, see Limits. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| TargetType | TargetParameter | Yes | The type of the resource to which events are to be pushed. | |
| Value | String | Yes | Exchange/Queue | The type of the resource to which events are to be pushed. Valid values:
|
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| Exchange | TargetParameter | Yes | The name of the exchange to which events are to be pushed in the destination instance. This parameter is valid only when you set the TargetType parameter to Exchange. | |
| Value | String | Yes | a_exchange | The name of the exchange in the ApsaraMQ for RabbitMQ instance. For more information, see Limits. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| RoutingKey | TargetParameter | Yes | The routing rule for the message. This parameter is valid only when you set the TargetType parameter to Exchange. | |
| Value | String | Yes | housekeeping | The routing rule for the message. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| QueueName | TargetParameter | Yes | The name of the queue to which events are pushed in the destination instance. This parameter is valid only when you set the TargetType parameter to Queue. | |
| Value | String | Yes | MyQueue | The name of the queue in the Message Queue for RabbitMQ instance. For more information, see Limits. |
| Form | String | No | CONSTANT | The transformation method. Default value: CONSTANT. |
| Body | TargetParameter | Yes | The content of the message. | |
| Form | String | No | TEMPLATE | The transformation method. |
| Value | String | Yes | | The value before the transformation. |
| Template | String | No | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
| MessageId | TargetParameter | Yes | The ID of the message. | |
| Value | String | Yes | | The value before the transformation. |
| Form | String | No | TEMPLATE | The transformation method. |
| Template | String | Yes | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
| Properties | TargetParameter | Yes | The tags that are used to filter messages. | |
| Value | String | Yes | | The value before the transformation. |
| Form | String | No | TEMPLATE | The transformation method. |
| Template | String | Yes | The value of ${key} is ${value}! | The template based on which events are to be transformed. |
Request parameter SinkSLSParameters
If you specify the SinkRabbitMQParameters parameter, you can configure the parameters described in the following table.
| Parameter | Type | Required | Example | Description |
| Project | String | Yes | test-project | The Log Service project. |
| LogStore | String | Yes | test-logstore | The Log Service Logstore. |
| Topic | String | No | testTopic | The topic in which the log resides. The value of this parameter is the same as the value of the reserved field "__topic__" in Log Service. |
| RoleName | String | Yes | testRole | The name of the role. If you want to authorize EventBridge to use this role to read the logs in Log Service, you must select Alibaba Cloud Service for the Selected Trusted Entity parameter, and select EventBridge for the Select Trusted Service parameter when you create the role in the RAM console. |
Response parameters
| Parameter | Type | Example | Description |
| EventStreamingARN | String | acs:eventbridge:cn-hangzhou:164901546557****:eventstreaming/myeventstreaming | The ARN of the EventStreaming. |
Examples
In the following sample requests and responses, events are routed from the custom event source of the ApsaraMQ for RocketMQ type to the event target Simple Message Queue (formerly MNS).
Sample requests
POST /eventstreaming/creatEventStreaming HTTP/1.1
Host: 164901546557****.eventbridge.cn-hangzhou.aliyuncs.com
Date: Sat, 18 Apr 2020 05:30:41 GMT
x-eventbridge-version: 2020-04-01
Authorization: acs vZ3VL0SuJdHi****:Jo2PbT******azYAYoYslKLvWzg=
Content-Type: application/json;charset=UTF-8
Content-Length: 26
{
"EventStreamingName":"myeventstreaming",
"Description":"rocketmq2mns",
"FilterPattern":"{}",
"Source":{
"SourceRocketMQParameters":{
"InstanceId":"MQ_INST_164901546557****_BAAN****",
"GroupID":"GID_group1",
"Topic":"mytopic",
"Offset":"CONSUME_FROM_TIMESTAMP",
"Tag":"",
"RegionId":"cn-hangzhou",
"Timestamp":1636597951964
}
},
"Sink":{
"SinkMNSParameters":{
"QueueName":{
"Value":"MyQueue",
"Form":"CONSTANT"
},
"IsBase64Encode":{
"Value":"true",
"Form":"CONSTANT"
},
"Body":{
"Value":{
"key":"value"
},
"Form":"TEMPLATE",
"Template":"The value of ${key} is ${value}!"
}
}
},
"RunOptions":{
"ErrorsTolerance":"ALL",
"RetryStrategy":{
"PushRetryStrategy":"BACKOFF_RETRY"
},
"DeadLetterQueue":{
"Arn":"acs:mq:cn-chengdu:164901546557****:/instances/MQ_INST_164901546557****_BXxk0KXx/topic/Mytopic"
}
}
}Sample responses
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 244BED53-719A-15D7-B7F9-1C404273****
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
"code":"200",
"data":{
"RequestId":"244BED53-719A-15D7-B7F9-1C404273****",
"Data":{
"EventStreamingARN":"acs:eventbridge:cn-hangzhou:164901546557****:eventstreaming/myeventstreaming"
},
"Code":"Success",
"Success":true
},
"httpStatusCode":"200",
"requestId":"244BED53-719A-15D7-B7F9-1C404273****",
"successResponse":true
}