IBM WebSphere JMS event publisher is used to publish events in m formats via JMS transport.
Follow the steps below to set up the prerequisites before starting the configuration.
- Start WSO2 CEP/DAS.
- Download and install WebSphere MQ pack with the latest fixes. For more information on installing, see the IBM documentation.
Configuring WebSphere MQ
Follow the instructions below to configure WebSphere MQ.
Configuring JMSAdmin.conf File
Go to the
<WebSphere_MQ_HOME>\java\bindirectory and open the
JMSAdmin.configfile in a text editor.
Comment out the existing INITIAL_CONTEXT_FACTORY and add a INITIAL_CONTEXT_FACTORY named com.sun.jndi.fscontext.RefFSContextFactory.
Comment out the default PROVIDER_URL and use a directory path instead. Ensure the directory is created in the file system (e.g., C:/JNDI-Directory).If there are .bindings files of earlier versions already existing in this folder, delete them. It should typically be an empty folder.
JMSAdmin.configfile should now look similar to this:
- Restart the WebSphere MQ service.
Creating the Queue in WebSphere MQ
- Start IBM WebSphere MQ Explorer and create a new queue manager. Make sure you select make this the default queue manager check box. Leave default values on the other fields.
- Select the options to Start Queue Manager , Autostart Queue Manager, and Create server connection channel , and then click Next .
- Select the option to create a listener configuration for TCP/IP, and provide a port number ( e.g., 1415 ).
- Select the created Queue manager and expand its navigation tree. Click Queues in the tree and create a new local queue (e.g., localq).
- Keep the default configurations and click Finish.
- Click Topics in the tree view and create a new local topic (e.g., localt).
- Right-click Channels under Advanced and select New > Server-connection Channel. Provide a name for the channel (e.g., myChannel), and click Next.
- Set the transmission protocol as TCP and click Finish.
A listener is created and is running on the given port (e.g., 1415). You should be able to view it by clicking the listeners icon.
Generating the .bindings file
Go to the
/java/bindirectory and invoke the IVT app by running the following command:
Create the default set of JNDI bindings by running the following command on the command prompt:
Execute the IVTRun tool as follows.
- You have now enabled and verified JNDI support. Now go to C:/JNDI-Directory to view the .bindings file there.
- Start the JMSAdmin tool by running the jmsadmin.bat file.
Modify the JNDI bindings by executing the following commands:
- In IBM WebSphere MQ Explorer, select JMS Administered Objects from the tree view on the left, and then select Add initial context. Once done, select File system and enter the JNDI directory path. This will bring up all created queues and topics.
You have now set up and configured IBM WebSphere MQ in your environment.
Configuring WSO2 CEP/DAS
Follow the instructions below to configure WSO2 CEP/DAS.
- If you set up WSO2 CEP/DAS on a different machine from WebSphere MQ, copy
C:/JNDI-Directoryto that machine. The bindings file allows you to access WebSphere queues from any machine in the network.
- Copy the following JAR files from the
<WebSphere_MQ_HOME>/java/libdirectory to the
- If you are using WebSphere MQ version 6.0 instead of version 7.0, add the following two JAR files. You might not find
com.ibm.mq.jmqi.jarin version 6.0.
Optionally, you might have to add the following jars as well.
- If you are using WebSphere MQ version 7.1 or later, add the following jars to the
Add the following files to the
Log in to the JMSAdmin tool and create a queue named bogusq by running the following commands in JMSAdmin shell.
localq is the queue we created earlier. We use two queues for the queue scenario, and the queue named bogusq is defined as the default destination since we need the default queue ( ivtQ ) for our proxy service only. If we use ivtQ here, all the services deployed in CEP (XKMS, echo, wso2carbon-sts etc.) will start listening on the same queue.
Repeat these steps for the topic scenarios. For example:
localt is the topic we created earlier.
<PRODUCT_HOME>\repository\conf\axis2\axis2.xmlfile as follows:
You will comment and uncomment the non-default connection factories depending on which scenario you are running, as described in the next section.For details on the JMS configuration parameters used in the code segments, see JMS Connection Factory Parameters.
Creating an IBM WebSphere JMS event publisher
For instructions on creating an IBM WebSphere JMS event publisher, see Configuring CEP to Create Alerts.
Configuring adapter properties
Specify the Static and Dynamic Adapter Properties, when creating an IBM WebSphere JMS event publisher using the management console as shown below.
After entering the above adapter properties, select the Message Format that you want to apply on the published events. Also, click Advanced to define custom output mappings based on the Message Format you selected. For more information on custom output mapping types, see Output Mapping Types.
You can also d efine the respective adapter properties of the event publisher based on the transport type within the
<to> element of the event publisher configuration in the
<PRODUCT_HOME>/repository/deployment/server/eventpublishers/ directory as follows.
Static adapter properties
|Configuration file property||Example|
|JNDI Initial Context Factory Class||The JNDI initial context factory class. The class must implement the |
|JNDI Provider URL||URL of the JNDI provider|
|Username||Valid username for the JMS connection|
|Password||Valid password for the JMS connection|
|Connection Factory JNDI Name||The JNDI name of the connection factory|
|Destination Type||The sort order for messages that arrive on a specific destination|
|Destination||The topic or queue to which WSO2 CEP/DAS sends messages by publishing|
Dynamic adapter properties
|Adapter Property||Description||Configuration file property||Example|
|Header||Define transport headers as a valid header name in a header value pair format||header_name1:header_value1,header_name2:header_value2|