Skip to content

Commit 12c4e81

Browse files
Ticket ## : Fix ETCD discovery + Add config discovery + update documentation
1 parent 9c2570b commit 12c4e81

37 files changed

Lines changed: 491 additions & 32 deletions

FaasNet.EventMesh.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FaasNet.EventMesh.Sink.Rock
7171
EndProject
7272
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FaasNet.EventMesh.Plugin", "src\EventMesh\FaasNet.EventMesh.Plugin\FaasNet.EventMesh.Plugin.csproj", "{47847CD3-9CF4-4BF3-984C-94013E48D444}"
7373
EndProject
74+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FaasNet.RaftConsensus.Discovery.Config", "src\RaftConsensus\FaasNet.RaftConsensus.Discovery.Config\FaasNet.RaftConsensus.Discovery.Config.csproj", "{C1FF9184-E53D-486C-B4A2-6455BA0D212D}"
75+
EndProject
7476
Global
7577
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7678
Debug|Any CPU = Debug|Any CPU
@@ -173,6 +175,10 @@ Global
173175
{47847CD3-9CF4-4BF3-984C-94013E48D444}.Debug|Any CPU.Build.0 = Debug|Any CPU
174176
{47847CD3-9CF4-4BF3-984C-94013E48D444}.Release|Any CPU.ActiveCfg = Release|Any CPU
175177
{47847CD3-9CF4-4BF3-984C-94013E48D444}.Release|Any CPU.Build.0 = Release|Any CPU
178+
{C1FF9184-E53D-486C-B4A2-6455BA0D212D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
179+
{C1FF9184-E53D-486C-B4A2-6455BA0D212D}.Debug|Any CPU.Build.0 = Debug|Any CPU
180+
{C1FF9184-E53D-486C-B4A2-6455BA0D212D}.Release|Any CPU.ActiveCfg = Release|Any CPU
181+
{C1FF9184-E53D-486C-B4A2-6455BA0D212D}.Release|Any CPU.Build.0 = Release|Any CPU
176182
EndGlobalSection
177183
GlobalSection(SolutionProperties) = preSolution
178184
HideSolutionNode = FALSE
@@ -205,6 +211,7 @@ Global
205211
{01E4D8EF-A594-4497-B1CA-D17372656006} = {B7CDEBEF-C508-4EFA-BEC9-9D9D6E5D80C5}
206212
{810659FD-5FAE-41B8-BC14-4499B6993CFB} = {B7CDEBEF-C508-4EFA-BEC9-9D9D6E5D80C5}
207213
{47847CD3-9CF4-4BF3-984C-94013E48D444} = {6E495E0A-0DC8-4E42-8C58-3C48506D3D24}
214+
{C1FF9184-E53D-486C-B4A2-6455BA0D212D} = {8B617B76-FFD2-4DBE-921E-B7DB73309530}
208215
EndGlobalSection
209216
GlobalSection(ExtensibilityGlobals) = postSolution
210217
SolutionGuid = {B9BD3B8C-B2C9-468F-BF54-66BFE9B565EC}

default.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ task publishEventMeshPlugins {
6666
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Sink.AMQP\FaasNet.EventMesh.Sink.AMQP.csproj -c $config -o $result_dir\sinkPlugins\FaasNet.EventMesh.Sink.AMQP }
6767
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Sink.Kafka\FaasNet.EventMesh.Sink.Kafka.csproj -c $config -o $result_dir\sinkPlugins\FaasNet.EventMesh.Sink.Kafka }
6868
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Sink.VpnBridge\FaasNet.EventMesh.Sink.VpnBridge.csproj -c $config -o $result_dir\sinkPlugins\FaasNet.EventMesh.Sink.VpnBridgea }
69+
exec { dotnet publish $source_dir\RaftConsensus\FaasNet.RaftConsensus.Discovery.Config\FaasNet.RaftConsensus.Discovery.Config.csproj -c $config -o $result_dir\discoveryPlugins\FaasNet.RaftConsensus.Discovery.Config }
70+
exec { dotnet publish $source_dir\RaftConsensus\FaasNet.RaftConsensus.Discovery.Etcd\FaasNet.RaftConsensus.Discovery.Etcd.csproj -c $config -o $result_dir\discoveryPlugins\FaasNet.RaftConsensus.Discovery.Etcd }
6971
}
7072

7173
task publishEventMeshService {

docs/documentation/eventmesh/cli.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,40 @@ Disable one plugin.
105105
| --------- | ----------- | ------------- |
106106
| -n/--name | Plugin name | |
107107

108+
## Get plugin configuration
109+
110+
**Command**
111+
112+
`get_plugin_configuration`
113+
114+
**Description**
115+
116+
Get plugin configuration
117+
118+
**Options**
119+
120+
| Option | Description | Default value |
121+
| --------- | ----------- | ------------- |
122+
| -n/--name | Plugin name | |
123+
124+
## Update plugin configuration
125+
126+
**Command**
127+
128+
`update_plugin_configuration`
129+
130+
**Description**
131+
132+
Update plugin configuration
133+
134+
**Options**
135+
136+
| Option | Description | Default value |
137+
| --------- | --------------- | ------------- |
138+
| -n/--name | Plugin name | |
139+
| -k/--key | Property key | |
140+
| -v/--value | Property value | |
141+
108142
## Version
109143

110144
**Command**
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Configuration file Peer Discovery
2+
3+
**Name**
4+
5+
DiscoveryConfigFile
6+
7+
**Description**
8+
9+
Use configuration file to discover peers.
10+
11+
**Link**
12+
13+
The ZIP file can be downloaded [here]().
14+
15+
**Options**
16+
17+
| Name | Description | Default value |
18+
| ----------------- | ----------------------------------------- | ------------------------------------------- |
19+
| clusterNodes | Cluster nodes | [{\"Url\":\"localhost\",\"Port\":4000}] |
20+
21+
## Quick start
22+
23+
Once you have an up and running EventMesh server with `DiscoveryConfigFile` plugin enabled, you can use the CLI to update the list of active peers for one specific EventMesh server.
24+
25+
```
26+
FaasNet.EventMeshCTL.CLI.exe update_plugin_configuration --name=DiscoveryConfigFile --key=clusterNodes --value="[{\"Url\":\"localhost\",\"Port\":4000}]"
27+
```
28+
29+
Enable the plugin and restart the EventMesh server to take into account your changes.
30+
31+
```
32+
FaasNet.EventMeshCTL.CLI.exe enable_plugin --name=DiscoveryConfigFile
33+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Etcd Peer Discovery
2+
3+
**Name**
4+
5+
DiscoveryEtcd
6+
7+
**Description**
8+
9+
Use Etcd to discover peers.
10+
11+
**Link**
12+
13+
The ZIP file can be downloaded [here]().
14+
15+
**Options**
16+
17+
| Name | Description | Default value |
18+
| --------------------- | ----------------------------- | -------------------------- |
19+
| etcdConnectionString | Etcd connection string | http://localhost:23790 |
20+
| etcdUsername | Etcd Username | |
21+
| etcdPassword | Etcd Password | |
22+
| etcdPrefix | URL prefix | eventmesh |

docs/documentation/eventmesh/plugins.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
EventMesh server supports plugins. Plugins extend core functionality in a variety of ways:
44
* Support more protocols.
55
* Support more sink connectors. A sink connector consumes records from an event store or message broker and stream the data events to the EventMesh server.
6+
* Support more discovery methods. To form a cluster, new nodes need to be able to discover their peers.
67

78
## Install a plugin
89

@@ -12,6 +13,7 @@ A plugin can manually be installed :
1213
3. Based on the nature of the plugin, move the folder into the appropriate sub-folder of the local EventMesh server.
1314
* If the plugin supports an additional protocol then the sub-folder is `protocolPlugins`.
1415
* If the plugin supports a new sink connector then the sub-folder is `sinkPlugins`.
16+
* If the plugin supports an additional discovery method then the sub-folder is `discoveryPlugins`.
1517

1618
## Enable a plugin
1719

@@ -53,4 +55,6 @@ The table below lists plugins
5355
| [ProtocolWebsocket](pluginwebsocket.md) | protocolPlugins | Support WebSocket protocol |
5456
| [SinkAMQP](pluginsinkamqp.md) | sinkPlugins | Consume records from AMQP server |
5557
| [SinkKafka](pluginsinkkafka.md) | sinkPlugins | Consume records from KAFKA server |
56-
| [SinkVpnBridge](pluginsinkvpnbridge.md) | sinkPlugins | Consume records from Virtual Private Network bridge |
58+
| [SinkVpnBridge](pluginsinkvpnbridge.md) | sinkPlugins | Consume records from Virtual Private Network bridge |
59+
| [DiscoveryConfig](plugindiscoveryconfig.md) | discoveryPlugins | Use configuration file to discover peers |
60+
| [DiscoveryEtcd](plugindiscoveryetcd.md) | discoveryPlugins | Use etcd to discover peers |
Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,66 @@
1-
TODO
1+
# Kafka sink
2+
3+
**Name**
4+
5+
SinkKafka
6+
7+
**Description**
8+
9+
Consume events from Kafka server.
10+
11+
**Link**
12+
13+
The ZIP file can be downloaded [here]().
14+
15+
**Options**
16+
17+
| Name | Description | Default value |
18+
| --------------------- | ------------------------------------------ | ----------------- |
19+
| jobId | Job identifier | EventMeshKafka |
20+
| kafkaBootstrapServers | List of brokers | localhost:29092 |
21+
| kafkaGroupId | Client group identifier | EventMeshKafka |
22+
| kafkaMetadataTimeout | Timeout in MS to fetch metadata from Kafka | 2 seconds |
23+
| kafkaTopicTimerMS | Timer in MS used to fetch kafka topics | 5 seconds |
24+
| eventMeshUrl | EventMesh server URL | localhost |
25+
| eventMeshPort | EventMesh server Port | 4000 |
26+
| eventMeshVpn | EventMesh server VPN | default |
27+
| clientId | Client identifier used to publish message | publishClientId |
28+
29+
## Quick start
30+
31+
Once the plugin `SinkKafka` is configured and enabled, you can deploy an Apache Kafka server.
32+
33+
In this tutorial we will explain how to deploy Apache Kafka by using Docker.
34+
35+
### Deploy Apache Kafka via Docker
36+
37+
Download the file
38+
39+
```
40+
https://raw.githubusercontent.com/simpleidserver/FaasNet/master/Samples/FaasNet.EventMesh.KafkaSink/docker-compose.yml
41+
```
42+
43+
Open a command prompt and execute the command below to deploy Apache Kafka
44+
45+
```
46+
docker-compose up
47+
```
48+
49+
### Update plugin configuration
50+
51+
Use the client identifier `publishClient`.
52+
53+
```
54+
FaasNet.EventMeshCTL.CLI.exe update_plugin_configuration --name=SinkKafka --key=clientId --value=publishClient
55+
```
56+
57+
### Enable the plugin
58+
59+
Enable the plugin and restart the EventMesh server to take into account your changes.
60+
61+
```
62+
FaasNet.EventMeshCTL.CLI.exe enable_plugin --name=SinkKafka
63+
```
64+
65+
Now the EventMesh server is running, it should be able to capture all the events coming from Apache Kafka.
66+
You can publish some messages in Apache Kafka and check if they are captured by the EventMesh server.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1+
# VPN Bridge sink
2+
3+
**Name**
4+
5+
SinkVpnBridge
6+
7+
**Description**
8+
9+
Consume events from VPN bridge
10+
11+
**Link**
12+
13+
The ZIP file can be downloaded [here]().
14+
15+
**Options**
16+
17+
| Name | Description | Default value |
18+
| --------------------- | --------------------------------------------- | ----------------- |
19+
| jobId | Job identifier | VpnBridge |
20+
| bridgeTimerMS | Timer in MS to get bridge servers | 5 seconds |
21+
| bridgeGroupId | Group identifier used to subscribe to a topic | VpnBridgeGroupId |
22+
| eventMeshUrl | EventMesh server URL | localhost |
23+
| eventMeshPort | EventMesh server Port | 4000 |
24+
| eventMeshVpn | EventMesh server VPN | default |
25+
| clientId | Client identifier used to publish message | publishClientId |
26+
127
TODO

docs/documentation/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
href: eventmesh/pluginsinkkafka.md
4646
- name: VPN bridge sink connector
4747
href: eventmesh/pluginsinkvpnbridge.md
48+
- name: Configuration file Peer Discovery
49+
href: eventmesh/plugindiscoveryconfig.md
50+
- name: Etcd Peer Discovery
51+
href: eventmesh/plugindiscoveryetcd.md
4852
- name: CLI
4953
items:
5054
- name: Overview

src/EventMesh/FaasNet.EventMesh.Client/Messages/Errors.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class Errors : IEquatable<Errors>
2929
public static Errors SESSION_LIFETIME_TOOSHORT = new Errors("SESSION_LIFETIME_TOOSHORT");
3030
public static Errors VPN_ALREADY_EXISTS = new Errors("VPN_ALREADY_EXISTS");
3131
public static Errors CLIENT_ALREADY_EXISTS = new Errors("CLIENT_ALREADY_EXISTS");
32+
public static Errors CANNOT_DISABLE_DISCOVERY_PLUGIN = new Errors("CANNOT_DISABLE_DISCOVERY_PLUGIN");
3233
private Errors(string code)
3334
{
3435
Code = code;

0 commit comments

Comments
 (0)