---
schema_version: "1"
id: aacc746f83aad68b1835143093211118f2627d9f07b349bd14888742d7afa041
title: IBM MQ Connector 1.9
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/ibm-mq-connector/1.9/index.md
canonical_url: https://docs.mulesoft.com/ibm-mq-connector/1.9/
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5aa27d03cef8b23be44e2353e906a9618c21b34e6ca8cfff483c7293bc7d7e55
description: MuleSoft Documentation Site
release: "1.9"
latest: false
---
---
product: IBM MQ Connector
version: 1.9
---

# IBM MQ Connector 1.9

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Anypoint Connector for IBM MQ (IBM MQ Connector) enables an app to do messaging to a IBM MQ Broker
using the IBM MQ JMS implementation. The main features include:

- Pub/Sub pattern support on any given destination.

- Listen/Reply pattern support on any given destination.

- Publish-Consume pattern support on any given destination, with fixed or temporary reply Queue.

- Non-blocking publishing and consumption of messages.

Release Notes: [IBM MQ Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/connector-ibm-mq)  
Exchange: [IBM MQ Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-ibm-mq-connector/)

## Connection Mode

When creating the IBM configuration, choose is the
[IBM connection mode](https://www.ibm.com/docs/en/ibm-mq/9.0.x?topic=SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q031720_.html)
to use.

As of IBM MQ 8, there are only two available connection modes, **Client** and **Binding**.

### Client Connection Mode

The client connection mode lets you connect to the IBM MQ Queue Manager running in the same system
that is being run the Mule Application or in other system. In both cases the IBM MQ Connector will
connect to the IBM MQ Queue Manager over TCP/IP.

For this connection mode are available the following configurations:

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Parameter</th><th>Required</th><th>Default Value</th><th>Description</th></tr></thead><tbody><tr><td><p>Host</p></td><td><p>TRUE</p></td><td></td><td><p>Host containing the IBM MQ Broker.</p></td></tr><tr><td><p>Port</p></td><td><p>FALSE</p></td><td><p>1414</p></td><td><p>Queue manager listener port.</p></td></tr><tr><td><p>Queue Manager</p></td><td><p>FALSE</p></td><td></td><td><p>The queue manager used when selecting a channel definition.</p></td></tr><tr><td><p>Channel</p></td><td><p>FALSE</p></td><td></td><td><p>Name of the channel to connect to.</p></td></tr><tr><td><p>Connection Name List</p></td><td><p>FALSE</p></td><td></td><td><p>Hosts to which the client attempts to reconnect after its connection is broken.<br>The connection name list is a comma separated list of host and IP port pairs.<br><strong>Example:</strong> <code>0.0.0.0(1414),somehost.domain.com(1415)</code></p></td></tr></tbody></table>

![Client Connection](/mulesoft/current/en-us/ibm-mq-connector/1.9/_images/ibm-mq-client-connection-mode.png)

Figure 1. Client Connection Configuration on Studio

Client Connection Configuration on XML

```xml
<ibm-mq:config name="IBM_MQ_Config">
 <ibm-mq:connection >
   <ibm-mq:connection-mode >
	 	<ibm-mq:client host="0.0.0.0" port="1414" queueManager="QM1" channel="DEV.ADMIN.SVRCONN" />
		</ibm-mq:connection-mode>
	</ibm-mq:connection>
</ibm-mq:config>
```

### Binding Connection Mode

The binding connection mode connects automatically to the IBM MQ broker running in the same system.

The unique parameter that is optionally configurable is the Queue Manager to connect to. If the IBM
MQ broker has a default Queue Manager, this configuration is not required.

![Client Connection](/mulesoft/current/en-us/ibm-mq-connector/1.9/_images/ibm-mq-binding-connection-mode.png)

Figure 2. Binding Connection Configuration on Studio

Binding Connection Configuration on XML

```xml
<ibm-mq:config name="IBM_MQ_Config">
  <ibm-mq:connection >
    <ibm-mq:connection-mode >
      <ibm-mq:binding queueManager="QM1" />
    </ibm-mq:connection-mode>
  </ibm-mq:connection>
</ibm-mq:config>
```

## Define Global Defaults

The IBM MQ `config` allows you to define multiple parameters to use as a default while consuming or
publishing messages. This way, you can define a global default behavior for all the operations
associated with the config and override each parameter only in the operations that require a custom
behavior.

For example, we can define a default `selector` behavior when consuming a Message in any of the
operations that are associated to this config, and also a default.

```xml
<ibm-mq:config name="IBM_MQ_Config">
  <ibm-mq:connection/>
  <ibm-mq:consumer-config selector="JMSType = `INVOICE`"/>
  <ibm-mq:producer-config timeToLive="60000"/>
</ibm-mq:config>
```

In this case, every consume or listener operation associated with this configuration uses the
`selector` by default, while every time a publish or publish-consume occurs, the outgoing message
has a TTL of 60 seconds.

All of these properties can be overridden at operation level when required. To publish a message
with a shorter TTL, use this example configuration that overrides the parameter:

```xml
<ibm-mq:publish config-ref="IBM_MQ_Config" timeToLive="10000"/>
```

## Select the JMS Spec

The main common parameter is the JMS specification used to select between all the supported
specifications, which are 2.0 and 1.1. This specification must be supported by the broker
implementation associated to this connection, otherwise the connection fails.

> [!WARNING] Features available only in JMS 2.0 won’t work with any other specification.

## Provide Credentials For Authentication

To establish an authenticated connection, you need to configure the username and password in the
connection element:

```xml
<ibm-mq:config name="IBM_MQ_Config">
	<ibm-mq:connection username="<username>" password="<password>" >
		<ibm-mq:connection-mode >
			<ibm-mq:client
			host="0.0.0.0"
			port="1414"
			queueManager="QM1"
			channel="DEV.ADMIN.SVRCONN" />
		</ibm-mq:connection-mode>
	</ibm-mq:connection>
</ibm-mq:config>
```

## Configure Connections Caching

To connect with a broker and execute the required operations, the JMS connector creates multiple
sessions, consumers, and producers that can be cached and reused to increase the performance of the
application. Because of this capability, the IBM MQ connector allows you to configure which caching
strategy to use when creating new connections, caching by default both consumers and producers, and
preserving as many instances as possible in memory at the same time.

Customizing the cache configuration can be done directly in the connection declaration:

```xml
<ibm-mq:config name="IBM_MQ_Config">
  <ibm-mq:connection>
    <ibm-mq:caching-strategy>
      <ibm-mq:default-caching sessionCacheSize="100" consumersCache="false" producersCache="true"/>
    </ibm-mq:caching-strategy>
  </ibm-mq:connection>
</ibm-mq:config>
```

## Identify the Connection Client

The client identifier associates a connection and its objects with a state maintained on behalf of
the client by a provider, and it is **mandatory** for identifying an unshared durable subscription.

```xml
<ibm-mq:config name="IBM_MQ_Config">
  <ibm-mq:connection clientId="${env.clientId}"/>
</ibm-mq:config>
```

> [!WARNING] By definition, the client state identified by a `clientId` can be "in use" by only one
> connection at a time.

## Set Up the Connection Required Libraries

**Important:** No matter what type of connection you are using, you always need to configure a
library containing the JMS client implementation, since the connector is not bound to any particular
implementation.

### IBM MQ External Libraries

To use the IBM MQ Connector, configure the external IBM MQ library, The IBM MQ Client library must
provide the `com.ibm.mq.jms.MQConnectionFactory` implementation.

> [!TIP] Use the IBM MQ Allclient library.

For example, you can use:

```xml
<dependency>
    <groupId>com.ibm.mq</groupId>
    <artifactId>com.ibm.mq.allclient</artifactId>
    <version>9.0.5.0</version>
</dependency>
```

## See Also

- [Consume Messages](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-consume)

- [Publish Messages](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-publish)

- [Listen For New Messages](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-listener)

- [Listen For A Reply](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-publish-consume)

- [Handle Message Acknowledgement](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-ack)

- [Handle Transactions in IBM MQ](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-transactions)

- [Tune For Performance](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-performance)

- [Connector Reference](https://docs.mulesoft.com/ibm-mq-connector/1.9/ibm-mq-xml-ref)

- [Salesforce Help](https://help.salesforce.com)
