A better way to send CICS events to WebSphere Business Events

WebSphere Business Events provides a technology connector that translates the XML packets received from a particular source into a format suitable for WebSphere Business Events runtime. On z/OS, a new feature in CICS Transaction Server V4.1 generates XML-formatted events and writes them as messages to a WebSphere MQ queue manager. To transport these messages to a WebSphere Business Events server requires the configuration of a started task, and this article shows you a simpler implementation that circumvents this requirement.

Edward McCarthy (edwardmc@au1.ibm.com), Senior Middleware Specialist and Client Technical Specialist, WebSphere on System z Technical Sales team, IBM

Edward McCarthy is an IBM certified Senior Middleware Specialist and Client Technical Specialist on the WebSphere on System z Technical Sales team for IBM Australia. He has more than 10 years experience working with WebSphere Application Server, and has contributed to several IBM Redbooks. Prior to joining IBM, he worked as a CICS and MQ system programmer. You can contact Edward at edwardmc@au1.ibm.com.



20 December 2010

Introduction

IBM® WebSphere® Business Events can help businesses detect, evaluate, and respond to events generated by various components of their systems. It serves as the event management layer in the IT infrastructure. For more information about WebSphere Business Events, see Resources at the bottom of the article.

IBM CICS® is used by many businesses worldwide to run their applications on z/OS. A new feature in CICS Transaction Server V4.1 (hereafter called CICS TS) generates events in WebSphere Business Events XML format. For information on two IBM Redbooks that describe this feature, see Resources.

When CICS TS produces an event in WebSphere Business Events XML format, you can configure it to write the XML data to a WebSphere MQ queue. You are then required to configure a technology connector as a started task to read the message and publish it to a topic on the WebSphere Business Events server. For details on this approach, see Resources. This article describes an alternative approach that does away with the requirement to set up this separate started task.

Background

This article evolved from a demo of CICS sending WebSphere Business Events XML messages to a WebSphere Business Events V7 server on z/OS. The documented method of setting up a started task seemed complex compared to the approach described in this article, which can be used to send event messages generated by CICS to a WebSphere Business Events V7 server on any supported operating system.

Overview of alternative approach

Figure 1. Alternative approach
Diagram showing alternative approach

Here is the sequence of events in the alternative approach:

  1. CICS detects that an event has occurred, collects the data, and writes it in WebSphere Business Events XML format to a queue.
  2. The queue is defined as a remote queue on the WebSphere MQ queue manager, and when the message is written, it ends up on a transmission queue.
  3. The queue manager sends the message to a destination on the SI Bus on the WebSphere Business Events server.
  4. A custom application on the WebSphere Business Events server GETs the message from the destination and publishes it to the topic.
  5. The WebSphere Business Events application processes the event message.

If you have WebSphere ESB or WebSphere Process Server, you can develop a mediation flow to perform the function that the custom application is doing. This approach requires:

  1. The custom application
  2. Channel definitions between the WebSphere MQ queue manager and the SI Bus in the WebSphere Business Events server
  3. Resource definitions in the WebSphere Business Events server
  4. Resource definitions in the WebSphere queue manger on z/OS

The custom application

You can download the custom application at the bottom of the article. The downloadable zip file contains mqToWbeProxy.zip and MQ-to-WBE.ear:

mqToWbeProxy.zip is a project interchange file that you can import into Rational Application Developer. It contains the application source code.

MQ-to-WBE.ear can be deployed on the WebSphere Business Events server. The application runs as a message-driven bean and the application code is straightforward. When a message arrives at the destination, the WebSphere Business Events server creates an instance of the ProxyMQEventMsgToWbeTopic class, and passes the message to it. The onMessage method in this class is invoked, with the message passed to it. The application then creates a connection to the Topic Connection Factory and publishes the message to the topic.

This application has two logical resources defined to it. One is a resource to be mapped to the WebSphere Business Events Topic Connection Factory, as shown in Figure 2:

Figure 2. Topic Connection Factory logical resource
Topic Connection Factory logical resource definition

The second resource is mapped to the WebSphere Business Events event topic, as shown in Figure 3:

Figure 3. Topic logical resource
Topic logical resource definition

A WebSphere Business Events server will already have resources defined to match up with the above logical resource references.

During deployment, when you get to the "Map resource references to resources" step, set the JNDI name for each of these resources by clicking Browse in the column "Target Resource JNDI Name":

Figure 4. Mapping logical topic resource to actual resource
Mapping logical topic resource to actual resource

A window opens showing all defined resources of type Topic. Select the entry with the JNDI name jms/EventTopic. The Topic Connection Factory resource will be displayed:

Figure 5. Mapping logical TopicConnectionFactory resource to actual resource
Mapping logical TopicConnectionFactory resource to actual resource

Click Browse in the column "Target Resource JNDI Name." A window opens showing all defined resources of type TopicConnectionFactory. Select the entry with the JNDI name ms/WbeTopicConnectionFactory, then complete the deployment of the EAR file in the normal way and save the changes.

WebSphere resources required for WebSphere MQ to WebSphere Business Events proxy application

Define the following WebSphere resources for the WebSphere MQ to WebSphere Business Events proxy application:

  • A destination to store the messages sent from the WebSphere MQ queue manager
  • A JMS queue definition to reference the destination
  • An activation specification

Defining the destination

In the WebSphere administrative GUI, expand Service integration => Buses, click on WbeBus, and then click on Destinations. A window opens. Click New.

Another window opens and asks what type of destination you want to create. Select Type of Queue and click Next. A window opens as shown in Figure 6:

Figure 6. Defining new destination
Defining new destination

Set the identifier to the value WbeOnSc55EventSpace2 and click Next.

You will be at Step 2 of the sequence shown in Figure 6.. From the dropdown box, select the bus on which the destination is to be defined, and then click Next.

You will then be at Step 3 of the sequence shown in Figure 6, the confirmation screen. Click Finish.

Then follow the normal process to save the change to the WebSphere configuration.

Defining JMS queue definition

In the WebSphere Administrative GUI, expand Resources => JMS and click Queues. Use the dropdown box for Scope to set the location in your cell where the resource is to be defined and then click New. Fill in the fields as shown in the table below:

Table 1. JMS Queue definition values
FieldValue
NameCICSEventMsg
JNDI NameJms/CICSEventMsg
Bus nameWbeBus
Queue nameWbeOnSc55EventSpace2

Let the other fields take default values. Click OK to save the new definition and then follow the normal process to save the change to the WebSphere configuration.

Defining activation specification

In the WebSphere administration GUI, expand Resources => JMS and then click Activation specifications. Use the dropdown box for Scope to set the location in your cell where the resource is to be defined, and then click New. Fill in the fields as shown in the table below:

Table 2. Activation specification definition values
FieldValue
NameMq-to-Wbe
JNDI Nameas/MQ-to-Wbe
Destination typeQueue
Destination JNDI nameJms/CICSEventMsg
Bus nameWbeBus

Click OK to save the new definition, and then follow the normal process to save the change to the WebSphere configuration.

Defining WebSphere MQ links to WebSphere Business Events server

To enable the z/OS WebSphere MQ queue manager to send messages to the SI Bus On the WebSphere Business Events server, you must define a foreign bus connection between the two. In the WebSphere administrative GUI, expand Service integration => Buses, and then select WbeBus => Foreign bus connections. Then click New.

A window opens and asks what type of Foreign bus connection is to be defined. Select Direct connection and then click Next.

in the next window, select WebSphere MQ and click Next:

Figure 7. Selecting Foreign bus type
Selecting Foreign bus type

In the next window, as shown in Figure 8 below, select from the dropdown the Messaging engine that will host the connection you are defining. In the Virtual queue manager name field, enter the name of the virtual queue manager associated with the messaging engine, and the name by which the messaging engine is known to the remote WebSphere MQ network.

Figure 8. Selecting messaging engine
Selecting messaging engine

Click Next. The following window opens:

Figure 9. WebSphere MQ details
WebSphere MQ details

Fill in the fields as shown in the table below:

Table 3. WebSphere MQ definition values
FieldValue
Foreign Bus NameMQCR
MQ link nameMQCR_on_SC66
WebSphere MQ receiver channel name sc55_wbeBus_to_MQCR
Host namewtsc66.itso.ibm.com
Port1415
WebSphere MQ sender channel nameMQCR_To_sc55_WbeBus

Of course, you need to use values that reflect your z/OS environment and WebSphere MQ queue manger. The port value is the TCP/IP port that the z/OS WebSphere MQ channel initiator is listening on. You can see the value in the channel initiator STC job log, in a message similar to this:

+CSQX023I -MQCR CSQXLSTT Listener started, 
port 1415 address *, TRPTYPE=TCP INDISP=QMGR

The channel names must exactly match the corresponding channel names in the WebSphere MQ queue manager channel definitions. If they do not then the channels will not start.

After deploying the application EAR file and defining all the required resources, stop and start the WebSphere Business Events server to bring all the changes into effect.

Resources required in WebSphere MQ queue manager

Define the following resources in the z/OS WebSphere MQ queue manager. The following examples of the required definitions show the values used in the IBM z/OS environment. Modify these values to suit your own environment.

Transmission queue

Issue the following command to define the transmission queue that will store messages that WebSphere MQ sends to the SI Bus in the WebSphere Business Events server:

define channel('MQCR_To_sc55_WbeBus') chltype(sdr)  
    conname('wtsc55.itso.ibm.com(14273)') 
    trptype(TCP) xmitq('edSc55WbeBus')

The port value of 14273 is the value assigned to the port SIB_MQ_ENDPOINT_ADDRESS in the WebSphere Business Events server.

Sender channel

Issue the following command to define the sender channel from the WebSphere MQ queue manager to the SI Bus in the WebSphere Business Events server:

define qlocal('edSc55WbeBus') usage(xmitq)

Receiver channel

Issue the following command to define the receiver channel between the WebSphere MQ queue manager and the SI Bus in the WebSphere Business Events server:

define channel('sc55_wbeBus_to_MQCR') chltype(RCVR) trptype(TCP)

Remote queue

Issue the following command to define the remote queue to which the CICS region writes the XML-formatted messages:

DEFINE     
    qremote('DP.CICS.CBE.INSUF.STOCK.SC55.WBE.ED')   
    DESCR('Edward Queue events insufficient stock')  
    XMITQ('edSc55WbeBus')    
    RQMNAME('WbeBus') RNAME('WbeOnSc55EventSpace2')

The value specified for the RNAME value must match the name of the destination queue defined in the SI Bus in the WebSphere Business Events server.

Starting the sender channel

Issue the following command to start the sender channel from the WebSphere MQ queue manager to the SI Bus in the WebSphere Business Events server:

start channel('MQCR_To_sc55_WbeBus')

If the channel starts, you should see this reply:

CSQXCRPS ' START CHANNEL' NORMAL COMPLETION

Also, in the WebSphere MQ channel initiator STC, you should see this message:

CSQX500I -MQCR CSQXRCTL Channel MQCR_To_sc55_WbeBus started

Checking that channel to SI Bus is started

In the WebSphere Business Events server, check the Adjunct region STC for the following message, which indicates that the channel from the WebSphere MQ queue manager to the SI Bus in the WebSphere Business Events server has started:

BBOO0222I: CWSIC3111I: The receiver channel MQCR_To_sc55_WbeBus 
for WebSphere MQ link MQCR_on_SC66 has started.

Checking connection status

You can check the status of the connection between the WebSphere MQ queue manager and the SI Bus in the WebSphere Business Events server. Select Service integration => Buses => Bus in use => Foreign bus connections => Your foreign bus connection => WebSphere MQ links to get to a display similar to that shown below:

Figure 10. Checking WebSphere MQ links
Checking WebSphere MQ links

Sending an event message

To test that your CICS region can send a WebSphere Business Events XML-formatted event message to the WebSphere Business Events server using this approach, your CICS TS V4.1 region must be set up to create such an event. For information on this task, see the two IBM Redbooks in the Resources section below.

Conclusion

WebSphere Business Events provides a specialised service to process and analyse real-time events received from any number of sources. This article has described a simpler way to establish the connectivity to send event messages from CICS TS V4.1 to a WebSphere Business Events server.


Download

DescriptionNameSize
Code sampleattachment.zip10 KB

Resources

  • IBM CICS resources
    • IBM Redbook: Implementing event processing with CICS
      This IBM Redbook explains business event processing with CICS TS, including CICS operating as a standalone system, or in conjunction with WebSphere Business Monitor and/or WebSphere Business Events.
    • IBM Redbook: Leveraging CICS events with an ESB
      This IBM Redbook shows examples of using three different IBM ESB products to transform and enrich events received from CICS TS. It also explains the basics of ESB technology, event processing, and the CICS TS implementation of event processing.
    • Running the technology connectors on z/OS
      Topic from WebSphere Business Events information center
    • IBM CICS product page
      Product descriptions, product news, training information, support information, and more.
    • IBM CICS TS for z/OS information center
      A single Web portal to all WebSphere Adapters documentation, with conceptual, task, and reference information on installing, configuring, and using CICS TS for z/OS.
    • IBM CICS services
      IBM has a comprehensive range of services to help you assess, plan, design, upgrade, secure, manage, implement, and successfully exploit CICS solutions within your organization. IBM CICS services can help you lower your costs and maintain a competitive advantage. Direct from the Hursley lab, we have the services and expertise to help you maximize your investment in CICS.
  • IBM WebSphere Business Events resources
  • IBM WebSphere resources
  • IBM developerWorks resources
    • developerWorks blogs
      Join a conversation with developerWorks users and authors, and IBM editors and developers.
    • developerWorks Webcasts
      Free technical sessions by IBM experts that can accelerate your learning curve and help you succeed in your most difficult software projects. Sessions range from one-hour Webcasts to half-day and full-day live sessions in cities worldwide.
    • developerWorks podcasts
      Listen to interesting and offbeat interviews and discussions with software innovators.
    • developerWorks on Twitter
      Check out recent Twitter messages and URLs.
    • IBM Education Assistant
      A collection of multimedia educational modules that will help you better understand IBM software products and use them more effectively to meet your business requirements.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


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. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

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.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

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

 


All information submitted is secure.

Dig deeper into Business process management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere
ArticleID=604478
ArticleTitle=A better way to send CICS events to WebSphere Business Events
publish-date=12202010