IBM Support

How to send and receive messages with Apache ActiveMQ JMS

Question & Answer


Question

How do you connect to Apache ActiveMQ with IBM Rational Integration Tester (RIT) of IBM Rational Test Workbench?

Cause

You want to use Apache ActiveMQ to send and receive messages. ActiveMQ does not provide a full Java Naming and Directory Interface (JNDI) server. Therefore additional configuration steps are required in RIT.

Answer

Consult the Apache ActiveMQ documentation and the RIT Java Message Service documentation.
Also consult your ActiveMQ administrator for connection details.

This example shows a topic connection using connection factory name TopicConnectionFactory on server activemqserver and topic MyTopic.

You first need to obtain the activemq-all-<version>.jar file where the version matches that of your ActiveMQ server. Additionally you need to create or copy an ActiveMQ JNDI definition file jndi.properties to the RIT system. A sample follows:


# START SNIPPET: jndi

java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory

# use the following property to configure the default connector
#java.naming.provider.url = vm://localhost
java.naming.provider.url = tcp://activemqserver:61616

# use the following property to specify the JNDI name the connection factory
# should appear as.
#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
connectionFactoryNames = TopicConnectionFactory

# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.MyQueue = example.MyQueue

# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.MyTopic = MyTopic

# END SNIPPET: jndi


Consider the following configuration steps.

  1. Exit RIT.

  2. Open Library Manager and click JMS.

  3. Add a new provider and add the files activemq-all-<version>.jar and jndi.properties.



  4. Click the check box to enable this provider.

  5. Click OK to save and exit Library Manager.

  6. Start RIT and create a JMS transport in Logical View of Architecture School.
    Right-click to edit the physical transport. Configure JNDI Settings as follows.

    Initial Context Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory (manually entered)
    Provider URLs: tcp:<hostname>:<port> e.g. tcp://activemqservert:61616

  7. Add the following to Properties.

    topic.<JNDI topic name> (type String) - value of physical topic name

    Here is an example.




  8. Configure Connection Settings.



  9. Use the transport in your tests.


[{"Product":{"code":"SSBLQQ","label":"IBM Rational Test Workbench"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Rational Integration Tester","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF022","label":"OS X"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;9.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21636686