RuleEngineJMS and IBM-MQSeries implementation

When you install Rule Engine JMS, the message broker set by default is ACTIVEMQ.

To implement using the message broker IBM-MQSeries, it is recommended that you install a new Rule Engine JMS runtime environment and that you modify it following the steps specified below.

In this document:

  • MQM_HOME refers to the environment of the product MQSeries server
  • HOME refers to the user's home directory

Generate the JNDI file using JMSAdmin

This generation is used to define JMS objects in relation to MQSeries objects.

To generate the JNDI file:

  1. Create the JNDI folder
  2. Load the JMS environment (UNIX only)
  3. Update the file JMSAdmin.config
  4. Create the JMS objects definition file using the editor
  5. Execute the JMSAdmin utility
  6. Check the generation of the JNDI file in the JNDI folder

Create the JNDI folder

The JNDI folder contains the generated JNDI file.

It is recommended that you create the JNDI folder in the directory RDJ_EXEC/script as shown below.

<RDJ_EXEC>/script>mkdir JNDI-IBM

<RDJ_EXEC>

Load the JMS environment (UNIX only)

To load the JMS environment, run the following command:

<MQM_HOME>/java/bin>. setjmsenv

MQ_JAVA_INSTALL_PATH is /usr/mqm/java

MQ_JAVA_DATA_PATH is /var/mqm

MQ_JAVA_LIB_PATH is /usr/mqm/java/lib

CLASSPATH is :/usr/mqm/java/lib/com.ibm.mq.jar:/usr/mqm/java/lib/com.ibm.mqjms.jar:/usr/mqm/samp/java/base:/usr/mqm/samp/java/jms

<MQM_HOME>/java/bin>

Update the file JMSAdmin.config

The file JMSAdmin.config is in the directory <MQM_HOME>/java/bin

Modify the following variables in the file JMSAdmin.config:

  • INITIAL_CONTEXT_FACTORY - describes the JMS objects in a "flat" file of type fscontext. See example below.
  • PROVIDER_URL - indicates the location of the JNDI file created earlier.
Caution   In Windows, you must use slashs (/) instead of antislashs (\) for the paths.

# ------------------------------------------------------------

# IBM Websphere MQ Support for Java Message Service

# This is the default configuration file for the Websphere MQ Classes for

# Java Message Service Administration Tool.

#

# %PUB_START%

# Licensed Materials - Property of IBM

#

# 5724-H72, 5655-L82, 5724-L26

#

# (c) Copyright IBM Corp. 2002, 2005

#

# US Government Users Restricted Rights - Use, duplication or

# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

# %PUB_END%

# ------------------------------------------------------------

#

# The following line specifies which JNDI service provider is in use.

# It currently indicates an LDAP service provider. If a different

# service provider is used, this line should be commented out and the

# appropriate one should be uncommented.

#

INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory

#

# The following line specifies the URL of the service provider's initial

# context. It currently refers to an LDAP root context. Examples of a

# file system URL and WebSphere's JNDI namespace are also shown, commented

# out.

#

PROVIDER_URL=file://<RDJ_EXEC>/script/JNDI-IBM

#

# The following line specifies the security authentication model in use,

# and may be 'none' (for anonymous authentication), 'simple', or 'CRAM_MD5'.

#

SECURITY_AUTHENTICATION=none

#

# If you don't have SECURITY_AUTHENTICATION=none, then JMSAdmin will

# prompt you for the User DN and password. If you want to bypass these

# prompts then you can specify one or both of the values here. Since

# the password here is in cleartext this is not normally recommended

# except for testing. You should replace these values with your own.

#

#PROVIDER_USERDN=cn=Manager,o=ibm,c=uk

#PROVIDER_PASSWORD=secret

#

#

# The following line determines whether to use an InitialDirContext, or an

# InitialContext. Takes value of TRUE or FALSE.

#USE_INITIAL_DIR_CONTEXT=TRUE

#

# The following line specifies a prefix to add to names when carrying out operations such

# as lookup/bind.

#NAME_PREFIX=cn=

#

# The following line specifies a marker at which names will be truncated when viewing

# the contents of the Context.

#NAME_READABILITY_MARKER=..

Create the JMS objects definition file using the editor

Manually create the JMS objects definition file and add the lines below using the editor. These lines are used to define the JMS objects in relation to the MQSeries objects created later.

Sample file: <HOME>/JMS.RE

Replace the following strings in the JMS objects definition file:

  • <HOSTNAME> : hostname of the UNIX/WIN machine hosting MQSeries
  • <PORT> : port listener MQ number - default : 1415
  • <JMS_CHL> : name of channel between JMS and MQSeries
  • <QMGR_NAME> : name of the MQSeries queue manager for the environment <RDJ_EXEC> (*)
  • <QRDJ_PREF> : MQSeries queue prefix for the environment <RDJ_EXEC> (*)

(*) For simplicity, use the same values for the JMS objects and the MQSeries objects.

DEFINE qcf(<QMGR_NAME>) qmgr(<QMGR_NAME>) host(<HOSTNAME>) port(<PORT>) transport(CLIENT) CHANNEL(<JMS_CHL>)

DEFINE Q(<QRDJ_PREF>.DETAIL.ANOMALY) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.DETAIL.ANOMALY)

DEFINE Q(<QRDJ_PREF>.DETAIL.REDIRECTION) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.DETAIL.REDIRECTION)

DEFINE Q(<QRDJ_PREF>.DETAIL.TRANSFORMATION) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.DETAIL.TRANSFORMATION)

DEFINE Q(<QRDJ_PREF>.IEVENT) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT)

DEFINE Q(<QRDJ_PREF>.IEVENT.AGGREGATION.COUNTER) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT.AGGREGATION.COUNTER)

DEFINE Q(<QRDJ_PREF>.IEVENT.ANOMALY) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT.ANOMALY)

DEFINE Q(<QRDJ_PREF>.IEVENT.MODIFIED) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT.MODIFIED)

DEFINE Q(<QRDJ_PREF>.IEVENT.REDIRECTED.I) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT.REDIRECTED.I)

DEFINE Q(<QRDJ_PREF>.IEVENT.REDIRECTED.J) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT.REDIRECTED.J)

DEFINE Q(<QRDJ_PREF>.IEVENT.REJECTED) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT.REJECTED)

DEFINE Q(<QRDJ_PREF>.IEVENT_TRACE.AUDIT) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.IEVENT_TRACE.AUDIT)

DEFINE Q(<QRDJ_PREF>.INCOMPLETED.GROUP) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.INCOMPLETED.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TRACE.AUDIT)

DEFINE Q(<QRDJ_PREF>.TRANSFORMATION.COUNTER) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.TRANSFORMATION.COUNTER)

DEFINE Q(<QRDJ_PREF>.UNREADABLE.MESSAGE) qmgr(<QMGR_NAME>) QU(<QRDJ_PREF>.UNREADABLE.MESSAGE)

END

Execute the JMSAdmin utility

To execute the JMSAdmin utility:

  1. Connect to the user administration MQSeries : mqm.
  2. Run the command below using the previously created file.

<MQM_HOME>/java/bin> JMSAdmin < <HOME>/JMS.RE

5724-H72, 5655-L82, 5724-L26 (c) Copyright IBM Corp. 2002,2005. All Rights Reserved.

Starting Websphere MQ classes for Java(tm) Message Service Administration

InitCtx>

InitCtx>

InitCtx>

Etc …

Stopping Websphere MQ classes for Java(tm) Message Service Administration

<MQM_HOME>/java/bin>

Check the generation of the JNDI file in the JNDI folder

To check the generation of the JNDI file, folow the example below.

<RDJ_EXEC>/script/JNDI-IBM> ll -a

total 208

drwxr-xr-x 2 mqm mqm 4096 Mar 18 16:22 .

drwxrwxrwx 14 mqm mqm 4096 Mar 18 16:12 ..

-rw-r--r-- 1 mqm mqm 90233 Mar 18 16:22 .bindings

rs37:/home/mqm/JNDI-RH>

Update the RuleEngine JMS runtime environment

You must physically create the MQSeries objects that have been previously defined in the JMSAdmin.config file and establish the connection between JMS and MQSeries.

To update the runtime environment:

  1. Create and start the MQSeries queue manager <QMGR_NAME>
  2. Create the MQSeries objects
  3. <RDJ_EXEC>/script>rdjadmmqs cre

    ================================================================

    R D J A D M

    ================================================================

    Setting Environment Variable for JMS Manager

    Environment Variable GES set to : jms

    Environment Variable COBOL_PROVIDER set to : microfocus

    Environment Variable RDJ_HOME set to : <RDJ_HOME>

    Environment Variable RDJ_EXEC set to : <RDJ_EXEC>

    Environment Variable RDJ_LANG set to : english

    Environment Variable QMGR_NAME set to : <QMGR_NAME>

    Environment Variable QRDJ_PREF set to : <QRDJ_PREF>

    Environment Variable MQ_BROKER set to : MQSERIES

    Environment Variable MQ_URL set to : file:<RDJ_EXEC>/script/jndi-IBM

    Creation of queues associated to the manager XRDJ.TRUNK.SIMU

    Creation of a local queue

    5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.

    Démarrage de MQSC pour le gestionnaire de files d'attente XRDJ.TRUNK.SIMU.

    1 : DEFINE QLOCAL(<QRDJ_PREF>.IEVENT) REPLACE +

    : DESCR('IEvent queue in entry of RDJ') +

    : DEFPSIST(YES) +

    : MAXDEPTH(9999999) +

    : MAXMSGL(4194304) +

    : NOSHARE +

    : DEFSOPT(EXCL) +

    : NOTRIGGER +

    : USAGE(NORMAL)

    AMQ8006: La file d'attente WebSphere MQ a été créée.

    Une commande MQSC lue.

    Aucune erreur de syntaxe dans les commandes.

    Toutes les commandes MQSC correctes ont été traitées.

    Creation of a local queue

    5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.

    Démarrage de MQSC pour le gestionnaire de files d'attente XRDJ.TRUNK.SIMU.

    1 : DEFINE QLOCAL(<QRDJ_PREF>.OSEGT.0) REPLACE +

    : DESCR('OSegt queue in output 0 of RDJ') +

    : DEFPSIST(YES) +

    : MAXDEPTH(9999999) +

    : MAXMSGL(4194304) +

    : NOSHARE +

    : DEFSOPT(EXCL) +

    : NOTRIGGER +

    : USAGE(NORMAL)

    AMQ8006: La file d'attente WebSphere MQ a été créée.

    Une commande MQSC lue.

    Aucune erreur de syntaxe dans les commandes.

    Toutes les commandes MQSC correctes ont été traitées.

    Creation of a local queue

    5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.

    Démarrage de MQSC pour le gestionnaire de files d'attente XRDJ.TRUNK.SIMU.

    Etc …

  4. Create the channel between JMS and MQSeries: <JMS_CHL>
  5. <RDJ_EXEC>/script>runmqsc <QMGR_NAME>

    5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.

    Démarrage de MQSC pour le gestionnaire de files d'attente XRDJ.TRUNK.SIMU.

    dis CHL(*) chltype(svrconn)

    1 : dis CHL(*) chltype(svrconn)

    AMQ8414: Affichage des détails relatifs au canal.

    CHANNEL(SYSTEM.AUTO.SVRCONN) CHLTYPE(SVRCONN)

    AMQ8414: Affichage des détails relatifs au canal.

    CHANNEL(SYSTEM.DEF.SVRCONN) CHLTYPE(SVRCONN)

    define CHL(<JMS_CHL>) chltype(SVRCONN) mcauser('mqm')

    3 : define CHL(<JMS_CHL>) chltype(SVRCONN) mcauser('mqm')

    AMQ8014: Le canal WebSphere MQ a été créé.

    <RDJ_EXEC>/script>

  6. Start the listener MQ in temporary mode: port <PORT> - default: 1415
  7. lola(hareng):/home/hareng>runmqlsr -m <QMGR_NAME> -t TCP -p 1415&

    [1] 19461

    lola(hareng):/home/hareng>5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.

    1. Check the monitoring: port 1415:
  8. lola(hareng):/home/hareng>grep 1415 /etc/services

    esg2_Integratorpool30 11415/tcp

    bucxib2_integrator_tracer 51415/tcp

    bucxib2_integrator_tracer 51415/tcp

    lola(hareng):/home/hareng>netstat -a | grep 1415

    tcp 0 0 *:1415 *:* LISTEN

    lola(hareng):/home/hareng>

  9. Edit the following variable in the rdjenv file located in the directory <RDJ_EXEC>/script :
  10. MQ_BROKER: indicate MQSERIES instead of ActiveMQ (default delivery)

Test in the RuleEngine JMS runtime environment

This environment is ready to run with the MQSeries message broker.

The machine hosting MQSeries is not necessarily the same as the one hosting Rule Engine.

To change the machine hosting MQSeries:

  • Define the same MQSeries objects (Queue Manager, Prefixe, Channel, Port listener)
  • Modify the JNDI file: Replace the value of <HOSTNAME> in the JNDI folder using one of the following methods:
    • M1 not recommended: make this change directly in the generated file .bindings of the JNDI file.
    • M2 standard: repeat the step of generating the JNDI file by modifying the JMS object creation file.

Main errors

Error code 8002

Console : ### classe com/axway/JMQCONN non trouvee ###

Rdjcleanjms.msg : UNABLE TO CONNECT TO THE LOCAL MANAGER 'XRDJ.TRUNK.SIMU': ERROR CODE 8002.

Cause : MQ_EXTDIRS does not contain all the files *.jar (wrapper + IBM)

Error code 9001

Rdjcleanjms.msg : UNABLE TO CONNECT TO THE LOCAL MANAGER 'XRDJ.TRUNK.SIMU': ERROR CODE 9001.

Cause : Wrong URL in jndi.properties / valeur de java.naming.provider.url

Error code 9002

Rdjcleanjms.msg : UNABLE TO CONNECT TO THE LOCAL MANAGER 'XRDJ.TRUNK.SIMU': ERROR CODE 9002.

Cause: URL Connection error / check information in JNDI QCF file (host,qmgr ..)

Example: Wrong host (sun30 instead of lola)

Related Links