Call the CreateEventSource operation to create an event source, including Alibaba Cloud official event source and external event source.
URL
/openapi/createEventSource
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
EventSourceName | String | Yes | rabbitmq.source | The name of the event source. |
Description | String | Yes | RabbitMQ event source | The description of the event source. |
LinkedExternalSource | Boolean | Yes | true | Specifies whether to associate an external data source.
Valid values:
|
ExternalSourceType | String | No | RabbitMQ | The type of the associated external event source, which includes the following three
types:
|
ExternalSourceConfig | Map | No |
|
The configuration of the associated external event source.
The configuration varies depending on the type of the associated external event source. For more information, see request parameters ExternalSoureConfig . |
EventBusName | String | Yes | demo-bus | The name of the event bus bound to the event source. For more information, see Limits. |
Request parameters ExternalSourceConfig
-
When ExternalSourceType Set the value to RabbitMQ When , ExternalSourceConfig You must set the following parameters.
Parameter Type Required Example Description RegionId String Yes cn-zhangjiakou Message Queue for RabbitMQ The region of the instance. InstanceId String Yes amqp-cn-nif22u74**** Message Queue for RabbitMQ The ID of the instance. For more information, see Limits. VirtualHostName String Yes eb-connect Message Queue for RabbitMQ The Vhost name of the . For more information, see Limits. QueueName String Yes demo Message Queue for RabbitMQ The name of the Queue. For more information, see Limits. -
When ExternalSourceType Set the value to RocketMQ When , ExternalSourceConfig You must set the following parameters.
Parameter Type Required Example Description RegionId String Yes cn-zhangjiakou Message Queue for Apache RocketMQ The region of the instance. InstanceId String Yes MQ_INST_1186095474286448_BXeq**** Message Queue for Apache RocketMQ The ID of the instance. For more information, see Limits. Topic String Yes demo Message Queue for Apache RocketMQ The name of the topic. For more information, see Limits. Tag String No test The filter label of the message. Offset String No CONSUME_FROM_LAST_OFFSET The consumer offset of the message. Valid values: - CONSUME_FROM_FIRST_OFFSET: Consumption starts from the earliest offset.
- CONSUME_FROM_LAST_OFFSET: Consumption starts from the latest offset.
- CONSUME_FROM_TIMESTAMP: Consumption starts from the offset at the specified time point.
GroupID String Yes GID_SOURCE Message Queue for Apache RocketMQ The group ID of the . -
When ExternalSourceType Set the value to MNS When , ExternalSourceConfig You must set the following parameters.
Parameter Type Required Example Description QueueName String Yes demo MNS The name of the Queue.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
EventSourceARN | String | acs:eventbridge:143998900779****:%s:eventsource/rabbitmq.source | The Uniform Resource Identification (ARN) of the event source on Alibaba Cloud. |
Example 1: The type of the external event source is RabbitMQ
Sample requests
POST /openapi/createEventSource HTTP/1.1
Host: 123456789098****.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
{
"Name":"rabbitmq.source",
"Description":"RabbitMQ event source",
"LinkedExternalSource ":true,
"ExternalSourceType":"RabbitMQ",
"ExternalSourceConfig":{
"VirtualHostName":"eb-connect",
"InstanceId":"amqp-cn-nif22u74****",
"RegionId":"cn-zhangjiakou",
"QueueName":"demo"
},
"EventBusName":"demo-bus"
}
Sample success 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: 5E9A9081333245F1D800****
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
"RequestId": "5E9AB1DF333245F1D800****",
"Code": "Success",
"Message": null,
"Data": {
"EventSourceARN":"acs:eventbridge:143998900779****:%s:eventsource/rabbitmq.source"
},
"Success": true
}
Example 2: The type of the external event source is RocketMQ
Sample requests
POST /openapi/createEventSource HTTP/1.1
Host: 123456789098****.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
{
"Name":"rocketmq.source",
"Description":"RocketMQ event source",
"LinkedExternalSource ":true,
"ExternalSourceType":"RocketMQ",
"ExternalSourceConfig":{
"InstanceId":"MQ_INST_1186095474286448_BXeq****",
"RegionId":"cn-zhangjiakou",
"Topic":"demo"
"Tag":"test"
"Offset":"CONSUME_FROM_LAST_OFFSET"
"GroupID":"GID_SOURCE"
},
"EventBusName":"demo-bus"
}
Sample success 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: 5E9A9081333245F1D800****
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
"RequestId": "5E9AB1DF333245F1D800****",
"Code": "Success",
"Message": null,
"Data": {
"EventSourceARN":"acs:eventbridge:143998900779****:%s:eventsource/rocketmq.source"
},
"Success": true
}
Example 3: The type of the external event source is MNS
Sample requests
POST /openapi/createEventSource HTTP/1.1
Host: 123456789098****.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
{
"Name":"MNS.source",
"Description":"MNS event source",
"LinkedExternalSource ":true,
"ExternalSourceType":"MNS",
"ExternalSourceConfig":{
"QueueName":"demo"
},
"EventBusName":"demo-bus"
}
Sample success 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: 5E9A9081333245F1D800****
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
"RequestId": "5E9AB1DF333245F1D800****",
"Code": "Success",
"Message": null,
"Data": {
"EventSourceARN":"acs:eventbridge:143998900779****:%s:eventsource/MNS.source"
},
"Success": true
}