Spring event to amqp message
In order to get relevant data pushed from the arsnova-backend to microservices like the arsnova-comment-service, the backend has to listen to the spring application events that are fired and has to forward them to the message broker. In order to restrict the network traffic, it should be configureable which events and what data should be sent per events.
The spring application events that need to be handled:
AfterCreationEvent
AfterDeletionEvent
AfterFullUpdateEvent
AfterPatchEvent
AfterUpdateEvent
The configuration could look like the following for each microservice:
- <entity type>:
type: <spring application event type>
attributes:
- <attribute>
- <attribute>
The exchange name will be: backend.<entity type>.<spring application event>
.
Note:
- If the attributes-array is empty, just send the event
- The arsnova-backend has to setup the exchanges
- The microservices have to register their queue onto the exchange
Concerns:
- a microservices must always be able to process all the events published to its queue to not pile up huge amounts of data
- for scaling the app, there has to be a fanout exchange between the arsnova-backend exchange and the microservice queue
Edited by ARSnova