You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by 沈林 <20...@gmail.com> on 2022/03/07 13:08:42 UTC

[DISCUSS] [RIP-38] RocketMQ EventBridge

Status
Current State: Proposed
Authors: shenlin, odbozhou
Shepherds: yukon, duhenglucky
Mailing List Discussion: dev@rocketmq.apache.org <ma...@rocketmq.apache.org>
Pull Request: #PR_NUMBER
Released: <released_version>
Background & Motivation
What do we need to do
Will we add a new module?

No, we would like to add a new repo “rocketmq-eventbridge”

Will we add new APIs?

Yes, new APIs and modules will be introduced in this system

Will we add a new feature?

Yes, it is a new feature.


We are building a new system “rocketmq-eventbridge” based on rocketmq, it’s an implementation of an event bus that makes it easier to build event-driven applications.

In addition, rocketmq-eventbridge can route events between many services and applications based on the standard CloudEvents 1.0 specification. Users can use rocketmq-eventbridge to build loosely coupled and distributed event-driven architectures.

Why should we do that
Are there any problems with our current project?

Currently, rocketmq doesn’t support event semantics definitely, our users have to develop EDA applications in a traditional way. Namely, developers wrap events as messages and send these messages via producer, then startup a rich consumer client to pull messages from the broker.

What can we benefit from proposed changes?

rocketmq-eventbridge supports the CloudEvents specification natively and is fully compatible with their binding protocols. That means, we can easily integrate with the CloudEvents ecosystem.

In addition, rocketmq-eventbridge will provide many models orient EDA, like event source, event bus, rule, event target. Developers can create these resources easily and build an EDA application in a low code manner.
Goals
What problem is this proposal designed to solve?
	
rocketmq-eventbridge is a production solution that makes it easier to build EDA applications, and this project will make the rocketmq ecosystem connected with the cloudevents community.
Non-Goals
What problem is this proposal NOT designed to solve?
	
rocketmq-eventbridge is not going to replace the traditional messaging solution, it’s just an effective complement to asynchronous communication applications.
Changes
We will create a new repo `rocketmq-eventbridge` to develop this system, and it won’t change the rocketmq kernel. This chapter focuses on the details of rocketmq-eventbridge, like models, architecture, APIs, etc.
Models
rocketmq-eventbridge consists of four models.

Event source: produce and publish cloudevents to rocketmq-eventbridge.

Event bus: receive and store events from event sources. An event bus consists of one or more rocketmq topics.

Event rule: filter and transform events. When a matched event occurs, the event is routed to the event target that is associated with the event rule.

Event target: processes and consumes events in a push manner. The event target doesn’t need to wrap a rocketmq consumer and can be any form of consumer, for example, a function, a restful application, etc. 

Architecture
Events are sent to the event bus in two ways: 1) Push events through the SDK or Webhook actively; 2) Pulled events by eventbridge passively. Events obtained in both ways will be stored on the event bus. EventBus is the core concept in EventBridge, which allows you to subscribe to the events, filter the events, and push to the specified target by creating the event rule. The event on the event bus is stored by rocketmq. Through rocketmq-connect, we can pull the event from the register source to the event bus, or push the events from the event bus to the registered target.

Interface Design
rocketmq-eventbridge won’t change any interface or method of rocketmq kernel, but it will design a set of new APIs.

Type
API Name
Description
EventBus API
CreateEventBus
Create a new event bus.
GetEventBus
Get the details of the event
 bus.
DeleteEventBus
Delete the event bus.
ListEventBuses
List all the event buses.
EventSource API
CreateEventSource
Create a new event source.
UpdateEventSource
Update the event source.
DeleteEventSource
Delete the event source.
ListEventSources
List all the event sources.
ListEventTypes
List the event types of event source.
Rule API
CreateRule
Create the event rule.
GetRule
Get the details of the event rule.
EnableRule
Enable the event rule.
DisableRule
Disable the event rule.
UpdateRule
Update the details of the event rule.
DeleteRule
Delete the event rule.
ListRules
List all the event rules.
Target API
CreateTargets
Batch create targets to the specified rule
UpdateTargets
Batch update targets of  the specified rule.
DeleteTargets
Batch delete targets of the specified rule.
Data API
PutEvents
Put the events to the specified eventbus. 
CreateEventBus
Create a new event bus.
Request
URI
/bus/createEventBus

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
true
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$
Minimum length of 1. Maximum length of 127.
demo
The name of the event bus.
Description
String
false
Maximum length of 1024.
"demo bus"
The description of the event bus.

Response

Field Name
type
Sample
EventBusName
String
demo
Example
Sample Request

POST /bus/createEventBus HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8
{
	"EventBusName":"demo",
"Description":"demo bus."
}

Sample Response

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
"RequestId": "5E9AB1DF333245F1D8000040",
"EventBusName": "demo"
}

GetEventBus
Get the details of the event
bus.

Request
URI
/bus/getEventBus

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$
demo
The name of the event bus.

Response

Field Name
type
Required
Sample
Description
EventBusName
String
True

demo
The name of the event bus.
Description
String
True
"my first eventbus"
The description of the event bus.
GmtCreate
Long
True
1581923450130
The created time of the event bus.
Example
Request
POST /bus/getEventBus HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName":"MyEventBus"
}
Response

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
"RequestId": "5E9AB1DF333245F1D8000040",
  	"EventBusName": "demo",
  	"Description": "my first eventbus"
}

DeleteEventBus
Delete the event bus.

Request
URI
/bus/deleteEventBus

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$
demo
The name of the event bus.

Response
HTTP status code is 200 if success, and only return request id.
Example
Request
POST /bus/deleteEventBus HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName":"demo"
}
Response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT
ListEventBuses
List all the event buses.

URI
/bus/listEventBuses

Request

Field Name
Type
Required
Notes
Sample
Description
NamePrefix
String
False
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$. 
my
The prefix of the event bus name.
NextToken
String
False
The default value is 0
“0”
The index of the next page first element.
MaxResults
Int
False
The default value is 10
10
The current query  page size.

Response

Field Name
type
Sample
Description
EventBuses
List<EventBus>

The event buses list.
NextToken
String

The index of the next page first element.
Total
Int

The total count of event buses.
MaxResults
Int

The current query  page size.

Example
Request
POST /eventbus/listEventBuses HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"NamePrefix":"my",
 	 "MaxResults":10
}
Response

HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
	"RequestId": "5E9AB1DF333245F1D8000040",
	"EventBuses": [
	  {
		 "EventBusName": "myEventBus1",
		  "Description": "my first default eventbus",
		  "GmtCreate": 1581923450130
		},
		{
		"EventBusName": "myEventBus2",
		  "Description": "my second eventbus",
		  "GmtCreate": 1581923450130
		}
	],
	"NextToken": "11",
             "MaxResults": 10,
             "Total": "101",
}
CreateEventSource
Create a new event source.
Request
URI:/source/createEventSource
Field Name
Type
Required
Notes
Sample
Description
EventSourceName
String
True
Maximum length of 127.
acs.oss
The name of the event source.
Description
String
True
Maximum length of 1024.
Aliyun mns event source.
The description of the event source.
SourceMNSParameters
Object
False


The parameter of MNS event source.
EventBusName
String
True
The created event buses.
demo
The event bus name of the event source.

The parameters of SourceMNSParameters:
Field Name
Type
Required
Notes
Sample
Description
RegionId
String
True
The region id must be existed.
cn-hangzhou
The region id of the aliyun.
QueueName
String
True
The queue must be existed.
demo
The queue name of mns.

Response
Field Name
type
Notes
Sample
Description
EventSourceName
String

mns.source
The created event source name.


Example
Request sample
POST /source/createEventSource HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8
{
    "Name":"mns.source",
    "Description":"the event source of mns",
    "SourceMNSParameters":{
        "RegionId":"cn-zhangjiakou",
        "QueueName":"demo"
    },
    "EventBusName":"demo"
}
Response sample:
{
  "RequestId": "5E9AB1DF333245F1D8000040", 
   "EventSourceName":"mns.source"
}


UpdateEventSource
Update the event source.

URI:/source/updateEventSource
Field Name
Type
Required
Notes
Sample
Description
EventSourceName
String
True
Maximum length of 127.
acs.oss
The name of the event source.
Description
String
True
Maximum length of 1024.
Aliyun mns event source.
The description of the event source.
SourceMNSParameters
Object
False


The parameter of MNS event source.
EventBusName
String
True
The created event buses.
demo
The event bus name of the event source.

Example
Request
POST /source/updateEventSource HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8
{
    "Name":"mns.source",
    "Description":"the event source of mns",
    "SourceMNSParameters":{
        "RegionId":"cn-zhangjiakou",
        "QueueName":"demo"
    },
    "EventBusName":"demo"
}

Response
HTTP status code is 200 if success, and only return request id.

DeleteEventSource
Delete the event source.
Request
URI:/openapi/deleteEventSource

Field Name
Type
Required
Notes
Sample
Description
EventSourceName
String
True

acs.ecs
The name of the event source.

Response
HTTP status code is 200 if success, and only return request id.
Example
Request
POST /source/deleteEventSource HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8
{
  	"EventSourceName":"acs.ecs"
}
Response
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
}
ListEventSources
List all the event sources within your account.

URI:/openapi/listEventSources
Request

Field Name
Type
Required
Notes
Sample
Description
NamePrefix
String
False
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$. 
my
The prefix of the event source name.
NextToken
String
False
The default value is 0
“0”
The index of the next page first element.
MaxResults
Int
False
The default value is 10
10
The current query  page size.

Reponse

Field Name
type
Sample
Description
EventBuses
List<EventBus>

The event buses list.
NextToken
String

The index of the next page first element.
Total
Int

The total count of event buses.
MaxResults
Int

The current query  page size.


Example
Request
POST /source/listEventSources HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName":"demo",
	"NamePrefix":"my",
 	 "MaxResults":10,
}
Response
{
       "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
       "EventSources":[
                {
                    "EventBusName": "demo-bus",
                    "SourceMNSParameters":{
                        "RegionId":"cn-hangzhou",
                        "QueueName":"demo"
                    },
                    "GmtCreate": ,
                    "GmtModify":,
                    "EventSourceName":"demo.source"
                }
            ]
        "NextToken": "11",
        "MaxResults": 10,
        "Total": "101",


    }
CreateRule
Create the event rule.



Request
URI
/openapi/createRule

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$
demo
The name of the event rule.
Description
String
False
Maximum length of 2014.
The demo rule
The description of the event rule.
Status
String
False
["ENABLE"|"DISABLE"]
enable
The status of the event rule.
FilterPattern
String
True
Json 
{
   "source": "acs.*",

}
The filter pattern of the event.

Response

Field Name
type
Sample
Description
EventRuleName
String
demo
The name of the event rule.

Example
Request
POST /rule/createEventRule HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
	"EventRuleName": "demo",
	"Description": "针对ECS的过滤规则",
	"Status": "ENABLE",
 	"FilterPattern": "{\"source\": [{\"prefix\": \"acs.\"}],\"type\": [{\"prefix\":\"oss:ObjectReplication\"}],\"subject\":[{\"prefix\":\"acs:oss:cn-hangzhou:1370104181926700:my-movie-bucket/\", \"suffix\":\".txt\"}]}",
}

Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
	"EventRuleName": "demo"
}

GetRule
Get the details of the event rule.
Request
URI
/rule/getRule



Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule.
demo
The name of the event rule.

Response

Field Name
type
Sample
Description
EventRuleName
String
MyEventBus
The event bus name
Description
String
demo
The name of the event rule.
Status
String
ENABLE
enable/disable the event rule.
FilterPattern
String

The filter pattern of the event.
GmtCreate
Long
1581923450130
The created time of the event bus.
GmtModify
Long
1581923450130
The modify time of the event bus.
Example
Request
POST /rule/getEventRule HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
  	"EventRuleName":"demo"
}
Response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
	"EventBusName": "default",
	"EventRuleName": "demo",
	"Status": "ENABLE",
	"FilterPattern": "{\"source\":[\"acs.oss\"],\"type\":[\"oss:BucketQueried:GetBucketStat\"]}",
}

EnableRule
Enable the event rule.


Request
URI
/rule/enableRule

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
RuleName
String
True
The existed event rule.
demo
The name of the event rule.

Response
HTTP status code is 200 if success, and only return request id.

Example
Request
POST /rule/enableEventRule HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
  "RuleName":"myRule3"
}
Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",

}

DisableRule
Disable the event rule.


Request
URI
/rule/disableRule

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
RuleName
String
True
The existed event rule.
demo
The name of the event rule.

Response
HTTP status code is 200 if success, and only return request id.

Example
Request
POST /rule/disableEventRule HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
 	 "EventRuleName":"demo"
}

Response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
}

UpdateRule
Update the details of the event rule.

Request
URI
/openapi/updateRule
Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule name.
demo
The name of the event rule.
Description
String
False
Maximum length of 2014.
The demo rule
The description of the event rule.
Status
String
False
["ENABLE"|"DISABLE"]
enable
The status of the event rule.
FilterPattern
String
True
Json 
{
   "source": "acs.*",

}
The filter pattern of the event.


Response
HTTP status code is 200 if success, and only return request id.
Example
Request
POST /rule/updateEventRule HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
	"EventRuleName": "demo",
	"FilterPattern": "{\"source\":[\"acs.oss\"],\"type\":[\"oss:BucketQueried:GetBucketStat\"]}"
}

Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",

}
DeleteRule
Delete the event rule.



Request
URI
/openapi/deleteRule

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule name.
demo
The name of the event rule.

Response
HTTP status code is 200 if success, and only return request id.
Example
Request
POST /rule/deleteRule HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
	"EventRuleName": "demo",
}
Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
}
ListRules
List all the event rules.


Request
URI
/openapi/listRules

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule name.
demo
The name of the event rule.
NextToken
String
False
The default value is 0
“0”
The index of the next page first element.
MaxResults
Int
False
The default value is 10
10
The current query  page size.

Response

Field Name
type
Sample
Description
EventRules
List<Rule>


NextToken
String

The index of the next page first element.
Total
Int

The total count of event buses.
MaxResults
Int

The current query  page size.
Rule
Field Name
type
Sample
Description
EventBusName
String

The event bus name
EventRuleName
String
MyEventBus
The name of the event rule.
Description
String
demo
The description of the event rule.
Status
String
ENABLE
The  status of the event rule.
FilterPattern
String
{\"source\":[\"acs.oss\"],\"type\":[\"oss:ObjectCreated:UploadPart\"]}
The filter pattern of the event.
GmtCreate
Long
1581923450130
The created time of the event bus.
GmtModify
Long
1581923450130
The modify time of the event bus.
Example
Request
POST /rule/listRules HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
	"RuleNamePrefix": "demo",
 	 "MaxResults": 10
}
Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D8000085
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
	"NextToken": "11",
	"Total": 102,
	"MaxResults": 10,
	"EventRules": [{
		"EventBusName": "default",
		"EventRuleName": "myRule1",
		"Status": "ENABLE",
		"FilterPattern": "{\"source\":[\"acs.oss\"],\"type\":[\"oss:ObjectCreated:UploadPart\"]}"
		}, {
		"EventBusName": "default",
		"EventRuleName": "myRule2",
		"Status": "ENABLE",
		"FilterPattern": "{\"source\":[\"acs.oss\"],\"type\":[\"oss:ObjectCreated:UploadPart\"]}"
	}]
}
CreateTargets
Batch create targets to the specified rule


Request
URI
/openapi/createTargets

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule name.
demo
The name of the event rule.
Targets
List<Target>
True


The targets to be created.

Target
Field Name
Type
Required
Notes
Sample
Description
EventTargetName
String
True
^[A-Za-z|0-9][A-Za-z|0-9|_|-]+$
Minimum length of 1. Maximum length of 127.
http-target
The name of the event target.
ClassName
String
True


The register name of the target class.
Config
Map<String, Object>
True


The config name of the target.
RunOptions
Object
True


The run options of the target.
RunOptions

Field Name
Type
Required
Notes
Sample
Description
ErrorsTolerance
String
False
ALL/NONE
ALL
Ignore the error or not.
RetryStrategy
Object
False


The strategy of retry when put events to target.
DeadLetterQueue
Object
False


The dead letter queue when put events failed after retry.

 RetryStrategy

Field Name
Type
Required
Notes
Sample
Description
ErrorsTolerance
String
True
BACKOFF_RETRY
/EXPONENTIAL_DECAY_RETRY
BACKOFF_RETRY
BACKOFF_RETRY(3 times: every 10s~20s)\EXPONENTIAL_DECAY_RETRY(176 times: 8s~16s~32s~64s~128s~256s~512s ... 512s(170))
MaximumEventAgeInSeconds
int
False

3600
The max age of event.
MaximumRetryAttempts
int
False

10
The max retry attempts.

 DeadLetterQueue

Field Name
Type
Required
Notes
Sample
Description
Type
String
True
MNS/RocketMQ
mns
The type of dead letter queue.
Config
Map<String, Object>
True
The config of dead letter queue.

The config of dead letter queue.

Response
HTTP status code is 200 if success, and only return request id.

Example
Request
POST /target/createTargets HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
	"EventRuleName": "myRule2",
	"EvetTargets": [{
		"EventTargetName": "target5",
		"ClassName": "http",
		"Config": {
			"URI": "http://www.myHost.com <http://www.myhost.com/>",
"Body": "test"
			}
		"RunOptions":  {
			"ErrorsTolerance": "ALL",
"RetryStrategy":  {
			"PushRetryStrategy": "BACKOFF_RETRY"
}
		}
	}]
}
Response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A908133324571D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
}

UpdateTargets
Batch update targets of the specified rule.

Request
URI
/target/updateTargets

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule name.
demo
The name of the event rule.
EventTargetNames
List<Target>
True


The targets to be updated.

Response
HTTP status code is 200 if success, and only return request id.

Example
Request
POST /target/updateTargets HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8
{
	"EventBusName": "default",
	"EventRuleName": "myRule2",
	"EvetTargets": [{
		"EventTargetName": "target5",
		"ClassName": "http",
		"Config": {
			"URI": "http://www.myHost.com <http://www.myhost.com/>",
"Body": "test"
			}
		"RunOptions":  {
			"ErrorsTolerance": "ALL",
"RetryStrategy":  {
			"PushRetryStrategy": "BACKOFF_RETRY"
}
		}
	}]
}
Response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A908133324571D800002F
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
}
DeleteTargets
Batch delete targets of the specified rule.
Request
URI
/target/deleteTargets

Field Name
Type
Required
Notes
Sample
Description
EventBusName
String
True
The existed event bus.
MyEventBus
The event bus name
EventRuleName
String
True
The existed event rule name.
demo
The name of the event rule.
EventTargetNames
List<Target>
True


The targets to be updated.

Response
HTTP status code is 200 if success, and only return request id.

Example
Request
POST /target/deleteTargets HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventBusName": "default",
	"RuleName": "myRule2",
	"EventTargetNames": ["target10"]
}
Response
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 79
x-eventbridge-request-id: 5E9A9081333245F1D130002F
Date: Sat, 18 Apr 2020 05:30:41 GMT
{
   "RequestId":"608C6467-3195-42A3-97B5-C51FB976620B",
}

PutEvents
Put the events to the specified eventbus. 
Request
URI
/putEvents

Field Name
Type
Required
Notes
Sample
Description
id
String
True

99418e3a-2025-41c6-a914-b8d6568e9f00
The event id.
source
URI
True

acs.oss
The source of the event.
specversion
1.0
False
Default value 1.0
1.0
The CloudEvents version.
type
String
True

oss:ObjectCreated:PostObject
The type of the event.
subject
String
True

acs:oss:cn-hangzhou:1234567890987654:xls-papk/game_apk/123.jpg
The subject of the event.
time
Date
False

2020-04-18T07:53:02.373Z
The subject of the event.
data
Object
False

{"field1":"xxxx","field2":"yyyy"}
The data of the event.
Response

Field Name
type
Sample
Description
FailedEntryCount
Int
2
The count of push failed events
EntryList
List<PutEventsResponseEntry>

The details of the each event.

PutEventsResponseEntry
Field Name
type
Sample
Description
EventId
String
99418e3a-2025-41c6-a914-b8d6568e9f00
The event id.
ErrorCode
String
Success
The error code of delivery event
ErrorMessage
String

The error message of delivery event

Example
Request
POST /putEvents HTTP/1.1
Host: xxxxxxxx.eventbridge.xxxx.com <http://xxxxxxxx.eventbridge.xxxx.com/>
Content-type: application/json;charset=UTF-8

{
	"EventList": [{
		"data": "test",
		"id": "99418e3a-2025-41c6-a914-b8d6568e9f00",
		"source": "acs.oss",
		"specversion": "1.0",
		"type": "oss:ObjectCreated:PostObject",
		"subject": "acs:oss:cn-hangzhou:1234567890987654:xls-papk/game_apk/123.jpg",
		"time": "2020-04-18T07:53:02.373Z"
	}],
	"EventBusName": "demo"
}

Response
HTTP/1.1 200 OK
Server: AliyunEventBridge
Connection: keep-alive
Content-Type: application/json;charset=utf-8
Content-Length: 171
x-eventbridge-request-id: 5E9AB1DF333245F1D8000040
Date: Sat, 18 Apr 2020 05:30:41 GMT

{
	"RequestId": "5E9AB1DF333245F1D8000040",
	"FailedEntryCount": 0,
	"EntryList": [{
		"EventId": "99418e3a-2025-41c6-a914-b8d6568e9f00",
		"ErrorCode": "Success"
	}]
}
Database Design


The above figure shows the database design of the new models.

 
Category
Table name
Meaning
Event Storage
event_bus
The event bus
event_topic
The connect between event bus and rocketmq topic
Event Source
evnet_source
The event source, include customized source
evnet_type
The type of cloudevents,
event_source_runner
The runner to execute source task
Event Rule
event_rule
The event rule to subscribe events from the bus and push to target
Event Target
event_target_runner
The runner to execute sink task
Event Ecosystem
event_source_class
The meta of event source
event_target_class
The meta of event target

Compatibility, Deprecation, and Migration Plan
This is a new project, so doesn’t need to consider compatibility or migration issues.
Implementation Outline
We will implement the proposed changes in 2 phases. 
 
Phase 1

Implement the basic features of rocketmq-eventbridge, which can be divided into the following steps:
Implement the APIServer of rocketmq-eventbridge, support cloudevents SDKs at the same time
Implement event bus on rocketmq topic
Implement event source/target on rocketmq-connect

Phase 2
Implement the advanced features of rocketmq-eventbridge based on rocketmq-connect:
Extend the filter and transform abilities among cloudevents based on rocketmq-connect. There will be another RIP to support related plugins in rocketmq-connect
Support some source/sink connectors for well-known systems and integrate with rocketmq-eventbridge
Pass all integration tests with rocketmq-eventbridge and rocketmq-connect

Rejected Alternatives
Nothing specific.