Skip to content

Clustering Atmosphere using Apache TomEE and ActiveMQ

Jeanfrancois Arcand edited this page Jun 27, 2014 · 5 revisions

Clustering Atmosphere using Apache TomEE and ActiveMQ is ssssimple. First, just install Apache TomEE, which, fortunalty for us, comes with ActiveMQ!.

Configure TomEE

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>

Atmosphere's Application Configuration

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!

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally