Using ActiveMQ For Distributed Replicated Cache
We plan to use activemq to build a replicated cache in our distributed system
consisting of multiple java applications. In this deployment, an update to
any of the objects being cached in the jvm memory of the app server acts as
a producer which pushes the pojo to the jms topic. All other app servers
subscribe to it and update the object that is cached by them. Here's a quick
deployment screenshot with 2 app servers. In production we would have a
maximum of 5-7 such app servers.
I would like to get suggestions on below queries
1. Given this is a real time use case (caching) we would want any updates
to be replicated to all other app servers as soon as possible. What broker
configurations should we consider to make sure that the messages are
delivered in real time in all possible flows?
2. Would it be good to maintain a continuous connection with the activemq
server on each app server in order to invalidate the cache in case the app
server fails to connect to activemq? If so, how could it be implemented?
3. How do we handle failure scenarios when the producer fails to push an
object to the topic (in which case we might have to rollback the database
transaction) or the consumer fails to receive the java object?
Looking forward for some insights.
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html