Skip to main content

Configuring connection to the WebSphere MQ native server using the WMQ component

When using the cMessagingEndpoint to address an endpoint in a WebSphere MQ native server by calling WMQ, the connection to the MQ QueueManager can be configured in the URI field or in a properties file. The following properties can be configured:

  • queueManagerName: The name of the MQ QueueManager. If not specified, the component falls back to default.

  • queueManagerHostname: The hostname of the MQ QueueManager.

  • queueManagerPort: The port of the MQ QueueManager.

  • queueManagerChannel: The channel of the MQ QueueManager.

  • queueManagerUserID: The user ID (optional, only required for authentication).

  • queueManagerPassword: The user password (optional, only required for authentication).

  • queueManagerCCSID: The CCSID (optional, only required for authentication).

If the queueManagerHostname, queueManagerPort, and queueManagerChannel is not specified in the URI, the component loads a mq.properties file from the classloader. An example of a mq.properties shown as follows:
default.hostname=localhost
default.port=7777
default.channel=QM_TEST.SVRCONN

The mq.properties can contain multiple MQ Queue Managers definition. The format is:

name.hostname
name.port
name.channel

where the name is the QueueManager name. For example, the mq.properties file can contain:

default.hostname=localhost
default.port=7777
default.channel=DEFAULT.SVRCONN
test.hostname=localhost
test.port=7778
test.channel=QM_TEST.SVRCONN

The mq.properties also supports the userID, password, and CCSID properties. For example:

default.hostname=localhost
default.port=7777
default.channel=DEFAULT.SVRCONN 
default.userID=mqm
default.password=mqm
default.CCSID=1208

To call the mq.properties, use a cConfig component and add it to the Dependencies table. To run the Route with this component in the studio, you need to download the com.ibm.mq.jar, com.ibm.mq.commonservices.jar, com.ibm.mq.headers.jar, com.ibm.mq.jmqi.jar and connector.jar from the IBM web site and add them to the Dependencies list of the cConfig too. For more information about the cConfig component, see cConfig.

If the Route with this component is deployed in Runtime, the mq.properties file will be called from <TalendRuntimePath>/container/etc folder. Furthermore, you need to download com.ibm.mq.osgi.java_7.5.0.5.jar from the IBM web site and add it to the <TalendRuntimePath>/container/deploy folder. Alternatively, copy the com.ibm.mq.jar, com.ibm.mq.commonservices.jar, com.ibm.mq.headers.jar, com.ibm.mq.jmqi.jar and connector.jar to the <TalendRuntimePath>/container/lib/ext folder and change <TalendRuntimePath>/container/etc/custom.properties by adding the MQ packages to org.osgi.framework.system.packages.extra:

org.osgi.framework.system.packages.extra = \
    com.ibm.mq; \
    com.ibm.mq.constants; \
    com.ibm.mq.exits; \
    com.ibm.mq.headers; \
    com.ibm.mq.headers.pcf; \
    com.ibm.mq.jmqi; \
    com.ibm.mq.pcf; \
    ...

For more information about the WMQ component, see the site https://github.com/camel-extra/camel-extra/tree/master/components/camel-wmq.

You can also use the cMQConnectionFactory component to create a connection to the WebSphere MQ native server, and use the cWMQ to communicate with the MQ QueueManager. For more information, see cMQConnectionFactory and cWMQ.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!