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:
  • true: Association
  • false: Not associated
ExternalSourceType String No RabbitMQ The type of the associated external event source, which includes the following three types:
  • RabbitMQ
  • RocketMQ
  • MNS
ExternalSourceConfig Map No

          { "VirtualHostName" : "eb-connect", "InstanceId" : "amqp-cn-nif22u74f00p", "RegionId" : "cn-zhangjiakou", "QueueName" : "demo"} 
        
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

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          
}