Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Integrating WebSphere Business Events with WebSphere MQ Low Latency Messaging

Doina Klinger, Advisory Software Engineer, IBM
Doina Klinger photo
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 (david_currie@uk.ibm.com), Advisory Software Engineer, IBM
David Currie
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 (dale.robertson@us.ibm.com), Senior IT Specialist, IBM
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."

Summary:  Learn how you can integrate the high-volume, low-latency messaging of WebSphere MQ LLM and the event pattern recognition of Business Events, to create a compelling solution for client situations that require a combination of these capabilities.

Date:  21 Jul 2010
Level:  Intermediate PDF:  A4 and Letter (167KB | 15 pages)Get Adobe® Reader®
Also available in:   Japanese

Activity:  5493 views
Comments:  

Introduction

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.


Business scenario

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.


The big picture

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
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.


Before you begin

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:

  1. 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.
  2. 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.
  3. 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_llm for the JNDI name, then click OK.

    Figure 2. Create J2C activation specification
    Create J2C activation specification

  4. 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
    Set custom properties

  5. 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.
  6. 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
    Specify JNDI name of the activation specification

  7. 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.

  8. Start the LLMAdapter application from the administrative console.
  9. 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.
  10. 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.

  11. 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.

Test the client

To test the client, complete the following steps:

  1. Import the client into an Eclipse-based tool.
  2. Create a run configuration for the RmmSender class in the LlmRmmSender package.
  3. 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.
  4. 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.


Understand the components

Let’s take a look at the various components and how they were developed.

MQ LLM inbound adapter

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:

  • LlmActivationSpec implements the JCA ActivationSpec interface. 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. The messageSelector property 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.

  • LlmResourceAdapter implements the JCA ResourceAdapter interface. This is a typical resource adapter class. The only specific method is endpointActivation, which constructs an instance of the LlmActiveEndpoint class.
  • LlmActiveEndpoint implements the MQ LLM's RmmMessageListener interface.
  • 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 RmmRxConfig structure 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 onMessage method deserializes the message and invokes the MDB.

Message-driven bean

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.

Business Events project

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.

Sender

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.


Conclusion

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.



Downloads

DescriptionNameSizeDownload method
WBE project, EAR, and RAR filesproject.zip863KBHTTP
project interchange filesWBE_LLM.zip1019KBHTTP

Information about download methods


Resources

About the authors

Doina Klinger photo

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

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."

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=501358
ArticleTitle=Integrating WebSphere Business Events with WebSphere MQ Low Latency Messaging
publish-date=07212010
author1-email=dklinger@uk.ibm.com
author1-email-cc=crothemi@us.ibm.com
author2-email=david_currie@uk.ibm.com
author2-email-cc=
author3-email=dale.robertson@us.ibm.com
author3-email-cc=crothemi@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers