Integration¶
Configuring a message for replication is pretty straightforward. First things first, lets add required references.
In our contracts project:
| XML | |
|---|---|
By convention, and since we want to replicate facts and not intents, we use events and not commands whenever it is possible. Exceptions may happen, of course, where we want to replicate a command instead, but these cases should be treated carefully.
Lets add the required interface to our event.
| C# | |
|---|---|
Now we need to configure a replication module where we can expose this message. If no such module is already present for the bounded context you are working on, we need to create a new one inside dotnet/src/services/Replication/ReplicableMessages/
You can do so by running the provided suite template and specifying your bounded context name for the project:
And add a reference to your contracts layer.
| XML | |
|---|---|
Now we can expose our message from inside ReplicationModule options:
| C# | |
|---|---|
The engine needs to be aware of the newly added message so it can respond as
expected when a Replicated{SpareUpdated} message is received. In order to do
so, just depend on your new module from the ReplicableMessages module under
Replication/ReplicableMessages/ITsynch.Suite.Replication.ReplicableMessages
| C# | |
|---|---|
Your application module needs some tuning aswell: add references to
ReplicationClientModule and your new ReplicationSparesModule.
| XML | |
|---|---|
| C# | |
|---|---|
The client module will set things up such that when a SpareUpdated is
published, a Replicated{SpareUpdated} is published aswell, which will then be
handled by the replication engine.