Publishing events to queues and exchanges
Using the Send/Publish Command on the Stream Adapter
The Devprime platform, through the Stream adapter, offers a common approach using the Publish/Send commands, as demonstrated below. This approach provides a consistent event publishing experience across all messaging and event platforms supported by DevPrime. This allows the implementation of an event-driven architecture from start to finish, using cloud native strategies, so that the exchange of streams can be done simply by changing the settings.
In the example below, implemented in the Application layer and within the EventHandler OrderCreatedEventHandler, it is possible to observe the use of the Send / Publish command with the following parameters:
| Parameter | Description |
|---|---|
| Destination | Queue Name/Topic/Exchange |
| Event | Name of the event issued by the DevPrime platform |
| Date | Event Content |
|
|
This method offers multiple overloads, allowing for a wide range of customizations. It also supports passing a different Stream “Alias”, useful in scenarios where you have more than one Stream platform linked to the same microservice.
Example:
|
|