Demonstration of event object syncing between multiple Spring contexts via RabbitMQ (Proof-Of-Concept). All events were be dispatched with Spring's ApplicationEventPublisher.
- Each
DistributedEvent
will be transformed in a serializable DTO (DistributedEventDTO
) pojo and sent to a RabbitMQ exchange fanout. - All running contexts have themselfes registered and bounded a temporarily queue to that exchange fanout.
- Using this fanout, all bounded queues will get a message which is a DTO of the
DistributedEvent
object. - All contexts get this message, transformed it back to an event and publish them via Spring's
ApplicationEventPublisher
.
This means that the context will receive its "own" event via RabbitMQ.
Start the application with the Main.java
found in the base package de.knallisworld.springcontextsync
. You can start multiple instances in parallel.
The App.java
in the base package defines statically which profiles are enabled: mq
and rabbit
. Follow the inlined documentation to change this.
Each instance creates its own unique id found in Application.java
(also base package).
The configuration of the Spring Integration can be found in resources/spring/integration.xml
. Any configuration keys used for the RabbitMQ connection are stored in the resources/application.properties
. The default is guest/guest
just like the RabbitMQ default are.
Copyright 2013 by Jan Philipp. Licensed under MIT.