Clustering Atmosphere using Apache TomEE and ActiveMQ - Atmosphere/atmosphere GitHub Wiki
Clustering Atmosphere using Apache TomEE and ActiveMQ is ssssimple. First, just install Apache TomEE, which, fortunalty for us, comes with ActiveMQ!.
Just edit conf/tomee.xml
and add
<Resource id="atmosphere" type="javax.jms.Topic" />
<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
BrokerXmlConfig = broker:(tcp://0.0.0.0:61616)
ServerUrl = vm://localhost
</Resource>
<Resource id="atmosphereFactory" type="javax.jms.ConnectionFactory">
ResourceAdapter = MyJmsResourceAdapter
</Resource>
First, add in pom.xml
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-jms</artifactId>
<version>2.X</version>
</dependency>
Next in web.xml
or atmosphere.xml
<init-param>
<param-name>org.atmosphere.plugin.jms.JMSBroadcaster.JNDINamespace</param-name>
<param-value>java:comp/env/jms/</param-value>
</init-param>
And finally, add in web.xml
<resource-ref>
<res-ref-name>jms/atmosphereFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<res-ref-name>jms/atmosphere</res-ref-name>
<res-type>javax.jms.Topic</res-type>
<res-auth>Container</res-auth>
</resource-ref>
That's it!