Skip to content

Commit 426e0c7

Browse files
Ticket #60: Document EventMesh protocol
1 parent f7e5bd9 commit 426e0c7

File tree

5 files changed

+104
-39
lines changed

5 files changed

+104
-39
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Concepts
2+
3+
## Server
4+
5+
Acts as a proxy between message brokers and clients.
6+
7+
![Architecture](images/eventmesh-1.png)
8+
9+
## Client
10+
11+
Client can be any types of application which implements the EventMesh protocol.
12+
13+
## Session
14+
15+
Client can have one or more sessions.
16+
There are two types of session :
17+
* SUB : subscribe to one or more topics.
18+
* PUB : publish messages.
19+
20+
## Bridge
21+
22+
Link between two servers. When a bridge is established, messages can be transfered from one server to an another.
23+
Any clients with an active session can subscribe to one or more topics present in different brokers and those brokers can be hosted on different machines.
24+
25+
The schema below shows a client who have active sessions on two EventMesh servers hosted on different machines.
26+
It has one active session which subscribed to the topic `Person.*`. Therefore the client can receive messages from two RabbitMQ brokers hosted on different machines.
27+
28+
![Bridge](images/eventmesh-2.png)
29+
30+
## CloudEvent
31+
32+
All messages coming from Brokers are translated into CloudEvent and vice versa.
63.5 KB
Loading
92.3 KB
Loading

docs/documentation/eventmesh/protocol.md

Lines changed: 66 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11
# EventMesh protocol
22

3-
## Concepts
4-
5-
### EventMesh Server
6-
7-
Acts as a proxy between message brokers and clients.
8-
9-
### Client
10-
11-
Client can be any types of application which implements the EventMesh protocol.
12-
13-
### Session
14-
15-
Client can have one or more sessions.
16-
There are two types of session :
17-
* SUB : subscribe to one or more topics.
18-
* PUB : publish messages.
19-
20-
### Bridge
21-
22-
Link between two servers.
23-
When a bridge is established, messages can transit from one server to an another.
24-
25-
### CloudEvent
26-
27-
All messages coming from Brokers are translated into CloudEvent and vice versa.
28-
29-
## Common Structure
30-
31-
### Message structure
3+
## Message structure
324

335
| Description | Data Type | Comment | Default Value |
346
| ------------------ | --------- | ----------------------------------------------------------------------------- | ------------- |
@@ -71,19 +43,38 @@ Known status:
7143
| 2 | aclFail |
7244
| 3 | tpsOverload |
7345

46+
Error status:
47+
48+
| Code |
49+
| ---------------------- |
50+
| NO_ACTIVE_SESSION |
51+
| NOT_AUTHORIZED |
52+
| NO_BRIDGE_SERVER |
53+
| INVALID_URL |
54+
| INVALID_CLIENT |
55+
| INVALID_SEQ |
56+
| INVALID_BRIDGE |
57+
| BRIDGE_NOT_ACTIVE |
58+
| BRIDGE_EXISTS |
59+
| UNKNOWN_BRIDGE |
60+
| UNAUTHORIZED_PUBLISH |
61+
| UNAUTHORIZED_SUBSCRIBE |
62+
7463
## Commands
7564

7665
### Heartbeat request
7766

78-
*Request* : HEARBEAT_REQUEST.
79-
*Response* : HEARTBEAT_RESPONSE.
67+
**Request** : HEARBEAT_REQUEST.
68+
69+
**Response** : HEARTBEAT_RESPONSE.
8070

8171
Heartbeat request are sent by client to check the availablity of an EventMesh Server.
8272

8373
### Hello request
8474

85-
*Request* : HELLO_REQUEST.
86-
*Response* : HELLO_RESPONSE.
75+
**Request** : HELLO_REQUEST.
76+
77+
**Response** : HELLO_RESPONSE.
8778

8879
Client send hello request to EventMesh server to create a session.
8980
The following informations are passed in the request. They are used by the EventMesh server to check if the client is authorized to subscribe or publish.
@@ -101,7 +92,7 @@ The following informations are passed in the request. They are used by the Event
10192
| Pid | int32 | Identifier of the process. |
10293

10394
> [!WARNING]
104-
> When a bridge is created between two EventMesh servers. The parameters `Urn` and `Port` will be used to transmit messages from one server to the second and to the client.
95+
> When a bridge is created between two EventMesh servers. The parameters `Urn` and `Port` will be used to transmit messages from one server to the second server and to the client.
10596
10697
When a session is created, an hello response is sent by the EventMesh server to the client.
10798
It contains a unique session identifier. This value will be used by the client to perform future operations.
@@ -112,8 +103,9 @@ It contains a unique session identifier. This value will be used by the client t
112103

113104
### Subscribe request
114105

115-
*Request* : SUBSCRIBE_REQUEST.
116-
*Response* : SUBSCRIBE_RESPONSE.
106+
**Request** : SUBSCRIBE_REQUEST.
107+
108+
**Response** : SUBSCRIBE_RESPONSE.
117109

118110
> [!WARNING]
119111
> A session is required to perform a subscription.
@@ -129,12 +121,47 @@ The following informations are passed in the request.
129121

130122
### Add Bridge request
131123

132-
TODO
124+
**Request** : ADD_BRIDGE_REQUEST.
125+
126+
**Response** : ADD_BRIDGE_RESPONSE.
127+
128+
Bridge request are sent to create a bridge between two EventMesh servers.
129+
The following informations are passed in the request :
130+
131+
| Description | Data Type | Comment |
132+
| ----------- | --------- | ----------------------------------- |
133+
| Urn | string | URN of the second EventMesh server |
134+
| Port | int32 | Port of the second EventMesh server |
135+
133136

134137
### Disconnect request
135138

136-
TODO
139+
**Request** : DISCONNECT_REQUEST.
140+
141+
**Response** : DISCONNECT_RESPONSE.
142+
143+
Disconnect request are sent by the client to close the session. When the session is closed, client cannot perform any future operations.
144+
The following informations are passed in the request :
145+
146+
| Description | Data Type | Comment |
147+
| ----------- | --------- | ------------------------- |
148+
| ClientId | string | Identifier of the client |
149+
| SessionId | string | Identifier of the session |
137150

138151
### Publish Message request
139152

140-
TODO
153+
**Request** : PUBLISH_MESSAGE_REQUEST.
154+
155+
**Response** : PUBLISH_MESSAGE_RESPONSE.
156+
157+
Publish message request are sent by the client to publish one message to a Topic.
158+
The following informations are passed in the request :
159+
160+
| Description | Data Type | Comment |
161+
| ----------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
162+
| ClientId | string | Identifier of the client |
163+
| SessionId | string | Identifier of the session |
164+
| Topic | string | Topic filter |
165+
| Urn | string | URN of the targeted EventMesh server. When the value is specified then the message is sent to the targeted server. Otherwise the message is broadcast to all the servers. |
166+
| Port | int32 | Port of the targeted EventMesh server |
167+
| CloudEvent | object | Message to send |

docs/documentation/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
href: serverlessworkflows/switch.md
1919
- name: Inject
2020
href: serverlessworkflows/inject.md
21+
- name: EventMesh
22+
items:
23+
- name: Concepts
24+
href: eventmesh/concepts.md
25+
- name: Protocol
26+
href: eventmesh/protocol.md
2127
- name: CLI
2228
items:
2329
- name: Overview

0 commit comments

Comments
 (0)