Integrate JBoss Messaging

In this procedure, you will learn how to integrate Kaazing Gateway and JBoss Messaging, a high-performance JMS provider that is used in combination with JBoss Application Server.

To Integrate JBoss Messaging

JBoss Messaging (a rewrite of JBossMQ) is a high-performance JMS provider that is used in combination with JBoss Application Server. JBoss Messaging is part of JBoss Application Server version 5.x, but you can also install and configure JBoss Messaging to work with older versions of JBoss Application Server.

With JBoss, you will need to create topics and queues using JBoss APIs or tools before connecting to them. Consult JBoss documentation for the appropriate steps to create destinations.

This section covers the following JBoss Messaging scenarios:

JBoss Application Server 4.x

To configure the Gateway to work with JBoss Application Server 4.x and JBoss Messaging, perform the following steps:

  1. Download and install JBoss Application Server 4.x following the instructions in the JBoss documentation. The directory that contains the application server installation is referred to as JBOSS_HOME.
  2. Download and install JBoss Messaging following the instructions in the JBoss documentation. The directory where JBoss Messaging is installed is referred to as JBOSS_MESSAGING_INSTALL_DIR.
  3. Copy the file JBOSS_MESSAGING_INSTALL_DIR/jboss-messaging-client.jar to GATEWAY_HOME/lib/ext.
  4. Copy the following JAR files from JBOSS_HOME/client to GATEWAY_HOME/lib/ext.
    • jbossall-client.jar
    • jboss-aop-jdk50.jar (optional)
    • javassist.jar
    • trove.jar (optional)

Note: Instead of copying the required JBoss jar files to GATEWAY_HOME/lib/ext, you can also modify the gateway.start or gateway.start.bat startup file to add these .JAR files (in their original *JBOSS_HOME* and *JBOSS_MESSAGING_INSTALL_DIR* locations) to the CLASSPATH when the Gateway starts.

  1. Open the file GATEWAY_HOME/conf/gateway-config.xml in a text editor and locate the jms service element (search for “jms”).
  2. Modify the jms service environment properties with the following:

      <properties>
        <connection.factory.name>ConnectionFactory</connection.factory.name>
        <context.lookup.topic.format>topic/%s</context.lookup.topic.format>
        <context.lookup.queue.format>queue/%s</context.lookup.queue.format>
        <env.java.naming.factory.initial>
          org.jnp.interfaces.NamingContextFactory
        </env.java.naming.factory.initial>
        <env.java.naming.provider.url>
          jnp://localhost:1099
        </env.java.naming.provider.url>
      </properties>
    

Note: You can also connect to your JBoss Messaging server using SSL. For more information, see JBoss Messaging documentation and Securing JBoss Messaging.

JMS Integration Verification for JBoss Application Server 4.x

To verify that the JMS integration is working, perform the following steps:

  1. Start the JBoss Application Server (with JBoss Messaging).
  2. Start the Gateway as described in Setting Up the Gateway.
  3. In a browser, navigate to the out of the box demos at http://localhost:8001/demo/.
  4. Click the JavaScript demo.
  5. Change the value for Location to ws://localhost:8001/jms.
  6. Change the value of all Destination text boxes to an existing topic or queue, for example /topic/testTopic.
  7. Click Connect.
    The message “CONNECT: ws://localhost:8001/jms” should appear in the log window followed by the message “CONNECTED: undefined.”
  8. Click Subscribe.
  9. Click Send. You should see the message that you sent in the message log.

To learn how to secure your JMS configuration: see Secure Your JMS Configuration.

JBoss Application Server 5.1.x

To configure the Gateway to work with JBoss Application Server 5.x, which includes JBoss Messaging, perform the following steps:

  1. Download and install JBoss Application Server 5.x following the instructions in the JBoss documentation. The directory that contains the application server installation is referred to as JBOSS_HOME.
  2. Copy the following JAR files from JBOSS_HOME/client to GATEWAY_HOME/lib/ext.

    • concurrent.jar
    • javassist.jar
    • jbossall-client.jar
    • jboss-aop-client.jar
    • jboss-client.jar
    • jboss-common-core.jar
    • jboss-logging-spi.jar
    • jboss-messaging-client.jar
    • jboss-mdr.jar
    • jboss-remoting.jar
    • jboss-serialization.jar
    • jnp-client.jar
    • trove.jar

    Note: Instead of copying the required JBoss jar files to GATEWAY_HOME/lib/ext, you can also modify the gateway.start or gateway.start.bat startup file to add these .JAR files (in their original JBOSS_HOME locations) to the CLASSPATH when the Gateway starts.

  3. Modify the JBoss profile.xml file.

    Change the constructor line of the AttachmentStore definition in JBOSS_HOME/server/default/conf/bootstrap/profile.xml (the original version of the file does not have the class="java.io.File" attribute):

    <bean name="AttachmentStore"
        class="org.jboss.system.server.profileservice.repository.AbstractAttachmentStore">
    <constructor>
        <parameter class="java.io.File">
            <inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" />
        </parameter>
    </constructor>
    
  4. Open the file GATEWAY_HOME/conf/gateway-config.xml in a text editor and locate the jms service element (search for “jms”).
  5. Modify the jms service environment properties with the following:

      <properties>
        <connection.factory.name>ConnectionFactory</connection.factory.name>
        <context.lookup.topic.format>topic/%s</context.lookup.topic.format>
        <context.lookup.queue.format>queue/%s</context.lookup.queue.format>
        <env.java.naming.factory.initial>
          org.jnp.interfaces.NamingContextFactory
        </env.java.naming.factory.initial>
        <env.java.naming.provider.url>
          jnp://localhost:1099
        </env.java.naming.provider.url>
        <!-- Static destinations support -->
        <destination.strategy>session</destination.strategy>
      </properties>
    

JMS Integration Verification for JBoss Application Server 5.1.x

To verify that the JMS integration is working, perform the following steps:

  1. Start the JBoss Application Server.
  2. Start the Gateway as described in Setting Up the Gateway.
  3. In a browser, navigate to the out of the box demos at http://localhost:8001/demo/.
  4. Click the JavaScript demo.
  5. Change the value for Location to ws://localhost:8001/jms.
  6. Change the value of all Destination text boxes to an existing topic or queue, for example /topic/testTopic.
  7. Click Connect.
    The message “CONNECT: ws://localhost:8001/jms” should appear in the log window followed by the message “CONNECTED: undefined.”
  8. Click Subscribe.
  9. Click Send. You should see the message that you sent in the message log.

Subscription and Destination Support

Kaazing Gateway integration with JBoss Messaging has the following subscription and destination support:

Notes

See Also