Event Bridge

event-bridge

Event Bridge supports message delivery across mesh clusters. Below is a detailed design and experience steps for this feature.

event-bridge-detail

Note: To experience this feature locally, you need to start two EventMesh instances and modify the port configuration in the eventmesh-runtime directory’s eventmesh.properties file to avoid port conflicts. For the sake of the following descriptions, the event-bridge feature is presented according to the information in the above diagram.

01 Remote Subscription

Description: Initiates a remote subscription command to cluster2 EventMesh. Upon receiving the command, cluster2 EventMesh will invoke the local subscription interface of cluster1 EventMesh with the subscription information.

URL: http://{cluster2 address}/eventmesh/subscribe/remote

Request Method: POST

Request Parameters: application/json format

ParameterTypeRequiredDescription
urlStringYesIdentifies the subscription URL, temporarily useless, will be replaced by (/eventmesh/bridge/publish) later, currently only for strong validation, will actually be replaced by the cluster2 EventMesh configuration information
consumerGroupStringYesIdentifies the consumer group information, will be replaced by the configuration information of cluster2 EventMesh
topicListYesIdentifies the subscription information list
modeStringYesIdentifies the consumption mode, divided into clustering mode and broadcast mode
topicStringYesIdentifies the subscribed topic
typeStringYesIdentifies the consumption type, divided into synchronous and asynchronous
remoteMeshStringNoIdentifies the remote mesh address, prioritized by obtaining from the registration center based on the topic, if not obtained, use this field to replace

Request Example:

  1. {
  2. "url": "http://127.0.0.1:8088/sub/test",
  3. "consumerGroup": "TEST-GROUP",
  4. "topic": [
  5. {
  6. "mode": "CLUSTERING",
  7. "topic": "TEST-TOPIC-HTTP-ASYNC",
  8. "type": "ASYNC"
  9. }
  10. ],
  11. "remoteMesh" : "http://127.0.0.1:10105/eventmesh/subscribe/local"
  12. }

02 Local Subscription

Description: Initiates a local subscription command to cluster2 EventMesh. Upon receiving the subscription command, cluster2 EventMesh will start locally listening for messages received from Event Store and push them to the URL in the subscription information.

URL: http://{cluster2 address}/eventmesh/subscribe/local

Request Method: POST

Request Parameters: application/json format

ParameterTypeRequiredDescription
urlStringYesIdentifies the subscription URL
consumerGroupStringYesIdentifies the consumer group information
topicListYesIdentifies the subscription information list
modeStringYesIdentifies the consumption mode, divided into clustering mode and broadcast mode
topicStringYesIdentifies the subscribed topic
typeStringYesIdentifies the consumption type, divided into synchronous and asynchronous

Request Example:

  1. {
  2. "url": "http://127.0.0.1:8088/sub/test",
  3. "consumerGroup": "TEST-GROUP",
  4. "topic": [
  5. {
  6. "mode": "CLUSTERING",
  7. "topic": "TEST-TOPIC-HTTP-ASYNC",
  8. "type": "ASYNC"
  9. }
  10. ]
  11. }

03 Send Message

Description: Sends a message to cluster1 EventMesh. Upon receiving the message, cluster1 EventMesh will send it to Event Store, and then push the message received from Event Store to the URL /eventmesh/bridge/publish of cluster2 EventMesh.

URL: http://{cluster1 address}/eventmesh/publish/TEST-TOPIC-HTTP-ASYNC

Request Method: POST

Request Parameters: application/json format

Request Example:

  1. {
  2. "name":"test",
  3. "age":"19"
  4. }

04 Remote Unsubscribe

Description: Sends an unsubscribe command to cluster2 EventMesh. Upon receiving the command, cluster2 EventMesh will send it to cluster1 EventMesh, and cluster1 EventMesh will locally execute the unsubscribe.

URL: http://{cluster2 address}/eventmesh/unsubscribe/remote

Request Method: POST

Request Parameters: application/json format

ParameterTypeRequiredDescription
urlStringYesIdentifies the URL to unsubscribe, temporarily useless, will be replaced by (/eventmesh/bridge/publish) later, currently only for strong validation, will actually be replaced by the group information of cluster2 eventmesh
consumerGroupStringYesIdentifies the consumer group information to unsubscribe from, will use the group information of EventMesh cluster2 to replace
topicListYesIdentifies the subscription topic information list

Request Example:

  1. {
  2. "consumerGroup": "EventMeshTest-consumerGroup",
  3. "url": "http://127.0.0.1:8088/sub/test",
  4. "topic": [
  5. "TEST-TOPIC-HTTP-ASYNC"
  6. ]
  7. }

05 Local Unsubscribe

Description: Sends an unsubscribe command to cluster2 EventMesh. Upon receiving the command, cluster2 EventMesh will locally execute the unsubscribe.

URL: http://{cluster2 address}/eventmesh/unsubscribe/local

Request Method: POST

Request Parameters: application/json format

ParameterTypeRequiredDescription
urlStringYesIdentifies the URL to unsubscribe from
consumerGroupStringYesIdentifies the consumer group information to unsubscribe from
topicListYesIdentifies the subscription topic information list

Request Example:

  1. {
  2. "consumerGroup": "EventMeshTest-consumerGroup",
  3. "url": "http://127.0.0.1:8088/sub/test",
  4. "topic": [
  5. "TEST-TOPIC-HTTP-ASYNC"
  6. ]
  7. }