WebSphere MQ Low Latency Messaging (hereafter called MQ LLM) is an IBM messaging product that facilitates high-volume, low-latency reliable messaging in a variety of network architectures. It is designed for one-to-many data delivery or many-to-many data exchange in a message-oriented middleware publish/subscribe fashion. It can achieve exceptionally high message volumes combined with sub-millisecond latency requirements. The current version of MQ LLM is designed primarily for the messaging requirements of the front-office of financial institutions.
In this article, we’ll show you how to use WebSphere Business Events (hereafter called Business Events) to consume MQ LLM messages. The integration is based on the J2EE Connector Architecture (JCA).
For more information about how Business Events interoperates with various IBM products, refer to the series Business Event Processing with WebSphere Business Events (developerWorks, 2009). This series demonstrates how Business Events can consume, as events, messages produced by WebSphere Enterprise Service Bus, WebSphere Monitor, WebSphere Message Broker, and WebSphere Process Server.
Consider the case of a stock exchange that uses algorithmic trading for entering automatic buying or selling orders. In this case, the timing, price, or quantity of the order is decided by computer algorithms. This type of trading is frequently used by pension or mutual funds and other forms of investments. The trading activity is subject to financial regulation whose objective is to protect clients, and identify and prosecute breaches of relevant laws on market misconduct, for example, insider trading.
The stock exchange could use MQ LLM for its automatic trading and would want to add the event pattern capabilities of Business Events to identify in real-time any speculative and illegal behavior. This would allow the stock exchange to act swiftly in such circumstances.
You should take into account that MQ LLM is a product specialized for high-volume messaging while Business Events is not designed for such scenarios. One way to bridge this gap is by using the message selector on activation specifications to apply filtering to all MQ LLM messages, and send to Business Events only the messages that are relevant for identifying event patterns. We describe this selection mechanism later in the article. Alternatively, you can use Business Events eXtreme Scale to filter out the MQ LLM messages before they are sent for event patterns.
By bringing together the high-volume, low-latency messaging of MQ LLM and the event pattern recognition of Business Events, you can create a compelling solution for client situations that require a combination of these capabilities.
Let’s take a look at the integration solution based on the architecture described in the JCA specification. This specification defines the standard contracts permitting communication between an enterprise application and an Enterprise Information System (EIS) like MQ LLM. For details on how this is accomplished, refer to JCA 1.5, Part 3: Message Inflow (developerWorks, 2005), which describes how to build and configure a resource adapter that can invoke methods on a non-JMS message-driven bean (MDB).
In this article, we’ll apply this technique to the MQ LLM case, focusing on the steps that are specific to this information system. Figure 1 illustrates the architecture of our solution:
Figure 1. MQ LLM adapter for Business Events
We’ll demonstrate how to build the inbound J2EE connector adapter that connects to MQ LLM as an asynchronous Reliable Multicast Messaging (RMM) receiver. Configuration for the receiver (including the topic name) is provided by a J2C activation specification defined using the WebSphere administrative console. We’ll show you how to install and configure this application, and how to build one.
MQ LLM comprises two protocols:
- RMM-based over UDP, IP, and native InfiniBand
- Reliable Unicast Messaging (RUM)-based over TCP
In this article, we’ll focus only on RMM.
RMM implements different levels of reliability on top of a standard unreliable networking infrastructure. This includes the UDP and IP multicasting protocols. RMM will also work over InfiniBand and shared memory, and can operate in either multicast (one-to-many) or unicast (one-to-one) mode. RMM achieves higher levels of reliability (over standard multicast) by buffering outgoing and incoming data. The total memory footprint of RMM and individual buffer sizes is configurable.
The adapter invokes an MDB packaged in the separate application. The MDB is responsible for transforming an MQ LLM message into a Business Events event message, and publishing it to a Business Events event topic. In our scenario, the MQ LLM message contains a serialized Java object, which is converted to Business Events XML format.
The downloadable archives provided with this article contain the adapter, the enterprise application, the sender, and the Business Events project.
Before we look at how it’s built, let's see the system in action. The scenario implemented in this article concentrates on the key technologies in the business scenario described above. An RMM client sends messages. The data from the messages is used to fill in the fields of a Business Events event. The event triggers some event processing logic in Business Events.
You’ll need both MQ LLM and Business Events installed on your machine.
We’ll refer to the MQ LLM installation directory as <LLM>. Make sure
that the <LLM>\lib32 directory (if on a 32-bit machine) is available
to the WebSphere Application Server (hereafter called Application Server)
process by adding it to the PATH variable in
Windows™.
Configure the activation specification
To configure the activation specification, complete the following steps:
- Start the Application Server administrative console, which is part of the Business Events installation. Typically, you can do this by launching the following URL in your Web browser: http://localhost:9060/ibm/console.
- Install the adapter, the LLMAdapter.rar file provided for download, on your server at node scope. Select Resources => Resource Adapters, then click Install Rar, and specify the path to the RAR file. Save the configuration.
- Create an MQ LLM activation specification at server scope by
selecting Resources => Resource Adapters => J2C
Activation Spec for the MQ LLM adapter. Select WebSphere MQ
LLM Adapter as the provider, which sets the message listener type, as
shown in Figure 2. Specify
jca/wbe_llmfor the JNDI name, then click OK.
Figure 2. Create J2C activation specification
- Set the custom properties for the activation specification. These
properties are explained in detail later in the article. For this
example, use the following, as shown in Figure 3:
-
groupName =
239.255.124.1 -
topicName =
topicA -
multicastInterface =
127.0.0.1 -
label =
25
For this example, we don’t specify a message selector. However, in a real-life application, you should make sure that Business Events receives only the relevant events for the patterns it is interested in.
Figure 3. Set custom properties
-
groupName =
- Install the LLMAdapter.ear. The administrative console installation wizard has six steps. On most screens, you can accept the defaults. Here, we’ll specify only the non-default information.
- During step 3 of the installation, enter the JNDI name of the
activation specification as
jca/wbe_llm, as shown in Figure 4.
Figure 4. Specify JNDI name of the activation specification
- During installation step 4, enter the JNDI name of the Business
Events event topic name, typically,
jms/eventTopic, and during step 5, specify the JNDI name for the JMS connection factory used by Business Events, typically,jms/WbeTopicConnectionFactory.You can safely ignore the warning (the provided connection factory is visible) and save the configuration, then save the changes to the master configuration.
- Start the LLMAdapter application from the administrative console.
- Download the Business Events project provided with this article, and deploy it as described in the Business Events Information Center topic Moving assets into production from Design Data.
- Reload the assets to the repository as described in the Business
Events Information Center topic Reloading the repository.
Note: The MQ LLM Information Center requires an access code. If you have purchased WebSphere MQ Low Latency Messaging, V2.3, you can request an access key that enables you to view the full Information Center. Instructions on acquiring the access code are available in the unprotected introductory section of the MQ LLM Information Center.
- Start the Business Events connector process by selecting Start
=> All programs => WBE 7.0 => Connectors. Create the
directory C:\WBETests. The actions will be generated in this
directory. Note that we use the connectors here only for demonstration
purposes to make it easy for you to see the actions being generated.
In a production deployment, you can read and process actions directly
off the
actionTopic.
To test the client, complete the following steps:
- Import the client into an Eclipse-based tool.
- Create a run configuration for the
RmmSenderclass in theLlmRmmSenderpackage. - Add a PATH environment variable to the configuration to point to the MQ LLM's lib32 directory. Note: This step is necessary only if you’re using a 32-bit machine; otherwise use the lib64 directory. Make sure that llmJni.jar is in the classpath.
- Execute RmmSender.
Alternatively, you can run the Java client outside Eclipse by adding the JAR files to the classpath.
In the Eclipse console view, you’ll see the “Message sent” message, and in the C:\WBETests directory, you’ll see the Business Events actions being generated as individual files. You can browse the content, which should look similar to the following:
<?xml version="1.1" encoding="UTF-8"?>
<connector xmlns="http://wbe.ibm.com/6.2/Action/CustomerConfirmation" name="WBE"
version="6.2">
<connector-bundle id="392B73408C7820220611DF0971E2F55C" name="CustomerConfirmation"
type="Action" workflow="FACE">
<Customer>
<currentPrice type="Real">9.9</currentPrice>
<lastPrice type="Real">9.9</lastPrice>
<stock type="String">IBM</stock>
<strikePrice type="Real">9.9</strikePrice>
<isCall type="Boolean">true</isCall>
<priceChange type="Real">9.9</priceChange>
<CustomerID type="String">custID</CustomerID>
</Customer>
</connector-bundle>
</connector>
|
The above steps show how the MQ LLM messages are consumed by Business Events, and how actions are generated.
Let’s take a look at the various components and how they were developed.
The MQ LLM inbound adapter is an asynchronous RMM receiver. It deserializes the messages and passes on the MDB. Let’s look at the adapter code, in particular the elements that are MQ LLM-specific.
The adapter archive contains the following classes:
-
LlmActivationSpecimplements the JCAActivationSpecinterface. It contains accessors for properties and a validation method. The properties that are specific to a RMM receiver are_groupName, _topicName, _label, _messageSelector, _dataPort,and_multicastInterface.Following is a short description of each of the MQ LLM properties. For more information, see Resources.
-
topicName: The name of the RMM topic. For example, this topic could be something like DEMO/WBEADAP/TEST01. -
groupName: The multicast group number. This must be a value between 224.0.0.0 and 239.255.255.255. Note that some multicast addresses may be reserved. Refer to Multicast Addresses for multicast group address assignment. -
dataPort: The destination port that is used in combination with the multicast group address; this defaults to 34343. -
multicastInterface: The address of the NIC (network interface card) on which the multicast data will be received. -
Label: If MQ LLM Turbo Flow (TF) labels are being used, you can supply a required TF label value. -
messageSelector: If MQ LLM message properties are being used, you can specify a specific property name and value. ThemessageSelectorproperty can be used to select only some of the messages that MQ LLM produces that are of interest to event processing logic. The rest of the messages are ignored.
The required properties for this activation specification are defined in the deployment descriptor ra.xml.
-
-
LlmResourceAdapterimplements the JCAResourceAdapterinterface. This is a typical resource adapter class. The only specific method isendpointActivation, which constructs an instance of theLlmActiveEndpointclass. -
LlmActiveEndpointimplements the MQ LLM'sRmmMessageListenerinterface. - The constructor creates the LMM configuration object and sets the
following properties:
protocol, dataPort, socketBufferSizeKBytesm, multicastInterface. It sets up the asynchronous receiver using MQ LLM APIs. - The
RmmRxConfigstructure is a set of parameters required to create an RMM receiver instance. The parameters comprising this structure are included in the MQ LLM Information Center.Some of these parameters include:
- The port on which the multicast data will be received.
- The address of the NIC on which the multicast data will be received.
- Whether multicast traffic can be received on the loopback interface, or whether the multicast transmitters are using the same NIC on which the data is being received.
- The size of the receive buffers.
- Whether IP V4 or IP V6 is being used.
- The name of an advanced configuration file, if one is being used.
- The
onMessagemethod deserializes the message and invokes the MDB.
The MDB transforms the MQ LLM message into a Business Events event using the Apache Velocity templating engine.
Apache Velocity is a Java-based template engine that provides a simple but powerful template language to reference objects defined in Java code. It can be used in a number of ways, for example, to create HTML pages with placeholders for dynamic information or to generate Java source code, SQL, or PostScript based on templates.
In our example, however, we’ll use it to generate the XML message that represents the Business Events event. The template is included below:
<connector name="Sales" version="6.2">
<connector-bundle name="Customer" type="Event">
<Customer>
<CustomerID type="String">$object.CustomerID</CustomerID>
<strikePrice type="Real">$object.strikePrice</strikePrice>
<stock type="String">$object.stock</stock>
<lastPrice type="Real">$object.lastPrice</lastPrice>
<currentPrice type="Real">$object.currentPrice</currentPrice>
<isCall type="Boolean">$object.isCall</isCall>
<priceChange type="Real">$object.priceChange</priceChange>
</Customer>
</connector-bundle>
</connector>
|
The template contains a combination of hard-coded elements that are specific to the event structure in Business Events, for example, the event field names and data fields that are filled from the incoming MQ LLM event. These elements are specified in Velocity syntax with fields prefixed with $. For example, the line
<CustomerID type="String">$object.CustomerID</CustomerID> |
indicates that the CustomerID field from the
incoming message will be inserted in the output message as the value of
the CustomerID attribute.
Note that the use of the Velocity in this context is not essential. You can use any library or classes that will generate the Business Events messages simply and efficiently.
Following are the MDB methods:
ejbCreate initializes the Apache Velocity
templating engine context and looks up the JMS-administered objects, the
connection factory, and destination.
onMessage invokes the template to get the
XMLmessage and sends it to the Business Events’ event topic.
Note that the classes for the object to be deserialized have to be packaged with the MDB.
A sample Business Events project is provided for download. The project contains a simple interaction set that upon receipt of the Customer always generates a confirmation action. The event has no connection information specified; that is, the event is sent directly to Business Events event topic.
The sender is a test application that publishes messages over RMM. A typical RMM transmitter application executes the following tasks:
As part of the initialization sequence, it:
- Creates a transmitter instance.
- Creates one or more transmitter topics.
As part of the main application logic, it:
- Serializes the application objects into an MQ LLM message buffer.
- Optionally, it can apply one or more TF labels to the message.
- Optionally, it can apply one or more message properties to the message.
- Submits the message for transmission to the MQ LLM layers.
As part of the application termination sequence (or when required), it:
- Closes the transmission topics that had been created.
- Stops the transmitter instance.
For more details about the specific APIs and the associated MQ LLM structures to execute these tasks, refer to the MQ LLM Information Center.
In this article, you learned how you can integrate MQ LLM with Business Events. You learned how to build the various components, and saw how those components work together to bring together low-latency messaging capabilities with event pattern recognition.
| Description | Name | Size | Download method |
|---|---|---|---|
| WBE project, EAR, and RAR files | project.zip | 863KB | HTTP |
| project interchange files | WBE_LLM.zip | 1019KB | HTTP |
Information about download methods
- The MQ LLM Information Center requires an
access code. If you have purchased WebSphere MQ Low Latency Messaging
V2.3, you can request an access key that enables you to view the full
Information Center. Instructions on acquiring the access code are
available in the unprotected introductory section of the MQ
LLM Information Center.
-
J2EE Connector Architecture
(JCA)
-
JCA
specification
- Business Event Processing with WebSphere Business Events
(developerWorks, 2009)
- JCA 1.5, Part 3: Message Inflow (developerWorks, 2005)
-
developerWorks BPM zone: Get the latest technical resources on
IBM BPM solutions, including downloads, demos, articles, tutorials,
events, webcasts, and more.

Doina Klinger is an Advisory Software Engineer at the IBM Hursley Software Laboratory. She is a developer for WebSphere Business Events. She has worked previously as a developer and development lead on a number of WebSphere products and components, most recently, WebSphere Enterprise Service Bus and WebSphere Integration Developer. She has an interest in Eclipse and messaging and event processing technologies. Doina joined IBM in 2000, having received an MSc in Computer Science from Purdue University. You can reach Doina at dklinger@uk.ibm.com.

David Currie is an Advisory Software Engineer based at the IBM Hursley Software Lab in the UK, where he is the development team lead for WebSphere ESB. Prior to this assignment, David worked in IBM Software Services for WebSphere and in the WebSphere Application Server development organization. David's areas of expertise include connectivity and transaction processing.
Dale Robertson is a Technical Specialist with the World-Wide Sales team for WebSphere Front Office (WFO) and WMQ-LLM. He is based in Massachusetts, USA. His areas of expertise include messaging, brokering and the enterprise service bus. He has over 35 years of experience in IT with the majority of it spent in data communications. He holds a M.S. in Project Management from The University of Sydney. He is also one of the authors of the IBM Redbook "WebSphere MQ Low Latency Messaging Development Guide."




