Subscribing to an event
The Devprime platform offers a CLI that boosts software developer productivity at every stage and provides the “dp add subscribe” command, which streamlines the implementation of a new Subscribe in the Stream Event Hub.
The Stream Adapter organizes the emission and receipt of events on the Devprime platform following a standard Devprime protocol and also enables the receipt of generic events sent by other applications.
Sending RabbitMQ/Kafka and other platforms events
“The Devprime platform provides a standardized approach to emitting events using the Stream Adapter and the Dp.Stream.Send(destination, eventName, eventData)
method. This method is independent of the technology used, even allowing switching between streaming services, such as RabbitMQ, Kafka, and other platforms.
In the example below, a DTO OrderCreatedEventDTO
is populated with the payload to be passed in the event, and then the Dp.Stream.Send(destination, eventName, eventData)
method is executed.
The ‘destination’ parameter represents the queue, topic, or exchange; ‘eventName’ is the name of the event; and ‘eventData’ represents the content to be streamed.”
|
|
Receiving events through queues or topics is a simple and transparent process through the Stream adapter. This process works regardless of the Stream technology adopted, be it RabbitMQ, Kafka, or any other service. After receiving the event, Stream directs it to Application Services, which in turn forwards it to Domain. The latter is solely responsible for processing the business rule.
In this way, the Devprime platform ensures that the flow of events is conducted efficiently and coherently, ensuring the integrity of operations and maintaining clarity in the execution of business rules.
In the example below, the Payment microservice is receiving the “OrderCreated” event and then passing the processing to the “Application Service” paymentService.
Standard events between applications based on the Devprime platform are handled in a standardized way, as shown in the example below ‘OrderCreated’.
|
|
Automatic Protocol on Event Events
The Stream Adapter uses a standard protocol for sending events, which manages information such as version, traceability, identification parameters, creation date, and payload. This information is visible in the queues or threads of the streaming tools and transparent to developers. Internally, they receive standardized, typed events in the Devprime platform.
|
|
The Devprime platform offers a CLI that boosts software developer productivity at every stage and provides the “dp add subscribe” command, which streamlines the implementation of a new Subscribe in the Stream Event Hub.