Access SwiftMQ with the Stomp Protocol


Stomp is a simple text oriented messaging protocol which has a list of implementations in different languages such as C, C++, Ruby, Python and so on. The Stomp project also provides a protocol translator called StompConnect which translates Stomp into JMS and vice versa. It is therefore possible to access any JMS provider via StompConnect.

SwiftMQ supports the hot deployment (during runtime) of any Java application into a SwiftMQ Universal Router. This can be done with StompConnect as well. However, SwiftMQ requires a shutdown method declared in the application to ensure that all resources are properly being closed during shutdown of the Router or redeployment of the application. StompConnect doesn't have such a shutdown method so we wrote a wrapper which does this and a few more things like providing an intravm connection factory for StompConnect.


  • Download StompConnect here.
  • Download the wrapper here.


Unpack and open the deployment descriptor config.xml with an editor:

    <?xml version="1.0" encoding="UTF-8"?>
         <system-property name="log4j.configuration" value="file:/Users/am/swiftmq_7_4_0/"/>

The wrapper accepts one optional argument which is the URI to create the Stomp listener. The deployment descriptor contains the default URI. Another configuration option is the log4j configuration file which is specified via system property "log4j.configuration". The we've used looks like this:

    # Set root logger level to DEBUG and its only appender to A1.
    log4j.rootLogger=DEBUG, A1

    # A1 is set to be a ConsoleAppender.

    # A1 uses PatternLayout.
    log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n


The deployment takes place in directory "jmsapp/routername" of your SwiftMQ distribution. Switch to that directory and create a subdirectory "stompconnect":

Copy all files from the StompConnect distribution plus the stompconnectwrapper.jar and config.xml into the "stompconnect" subdirectory:

StompConnect is now deployed and will be started from the SwiftMQ Universal Router:

   +++ Hot Deployed JMS Application 'stompconnect' started
   0    [SwiftMQ-jac.runner-1] INFO  org.codehaus.stomp.jms.StompConnect  - Looking up name: IVMConnectionFactory in
            JNDI InitialContext for JMS ConnectionFactory
   41   [SwiftMQ-jac.runner-1] INFO  org.codehaus.stomp.tcp.TcpTransportServer  - Listening for connections at: