Distributed Bus
Distribution
Ecotone
provides support for communication in distributed architecture.
The support covers sending command directly to specific service (application) or publishing events, that other services can subscribe too.
Configuration
In order for Ecotone
how to route messages you need to register Service Name (Application Name).
Modules Providing Support
Distribution Bus
Distribution Bus is Message Gateway just like CommandBus or EventBus. The bus is responsible for distribution of your command and events.
Depending on your Module configuration you can inject it by class name
or specific reference name
.
Commands
Sending Distributed Commands
destination
- is a Service Name of targeted ServiceroutingKey
- is a routing key under which CommandHandler is registered on targeted Service
Consuming distributed command
On the consumer side register distributed command handler
To expose command handler for service distribution mark it with Distributed
attribute.
Run the consumer
Run consumer for your registered distributed consumer. It will be available under your Service Name
List:
Run it:
Events
Publishing Distributed Events
routingKey
- is a routing key under which event will be published
Consuming Distributed Events
To start listening for distributed events under specific key, provide Distributed
attribute.
Run the consumer
It's the same consumer, so we run it just like distributed command bus.
Message
You may distribute general message, if you don't want to include given endpoint as Command or Event Handler.
Publishing Distributed Messages
destination
- is a Service Name of targeted ServicetargetChannelName
- is a target channel on the destination side
Consuming Distributed Messages
We register general Message Handler using Service Activator.
Run the consumer
It's the same consumer, so we run it just like distributed command bus.
Last updated