I have to design and implement mechanism which handle such situation:
There are two applications, let's say App1 and App2 and OpenMQ Broker between those applications. Furthermore there are two queues on this Broker - ControlQueue and DataQueue.
Under normal conditions (when both App1 and App2 are alive) App1 sends some real time data to DataQueue and App2 receives that data. App1 caches data and has a refresh functionality in case App2 need to update all data.
- App2 to maintain connection every ten seconds sends PING message to ControlQueue.
- App1 receives PING messages from ControlQueue and saves the time of last PING message.
- Every time App1 receives PING message it checks if data is sending to DataQueue. If not, it launches refresh and send cached and real time data to DataQueue.
- App1 (by QueueConectionMaintainer) checks every ten seconds if time of last PING message is later than 25 seconds and if yes then it stop sending data to DataQueue.
App1 is created with Spring Integration and use jms:inbound-channel-adapter to receive messages from ControlQueue.
Ad.1.
PING message is a jms object message with Properties object inside
Ad.2, Ad.3
Connection with OpenMQ - Spring Integration configuration:
Queue listener - Spring Integration configuration:
ControlQueueListenerActivator implementation:
Ad.4 Queue connection maintainer - Spring Integration configuration: QueueConnectionMantainer implementation:
Brak komentarzy:
Prześlij komentarz