IBM MQ Source Connector for Confluent Cloud

The fully-managed IBM MQ Source connector for Confluent Cloud reads messages from an IBM MQ cluster and then writes them to an Apache Kafka® topic.

Note

Features

The IBM MQ Source connector provides the following features:

  • This connector guarantees that records are delivered at-least-once to the Kafka topic.
  • Client-side field level encryption (CSFLE) support: The connector supports CSFLE for sensitive data. For more information about CSFLE setup, see the connector configuration.
  • Multiple tasks: The connector supports multiple tasks. More tasks may improve performance.
  • JMS message types: The connector supports TextMessage and BytesMessage. It does not support ObjectMessage or StreamMesssage.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Limitations

Be sure to review the following information.

Errors and retry attempts

The IBM MQ Source connector uses the general retry policy implemented for most Kafka Connect connectors. Additionally, the IBM MQ Source connector uses exponential backoff after each retry attempt. The backoff time is the time between retries and a random value between zero and the exponentially increasing bound. The exponential bound is capped at one minute and the initial backoff time is set to 100 milliseconds (ms).

initialbackoffTime * 2 ^ (retry-1)

The following errors will trigger a retry. With the exception of MQRC_GET_INHIBITED, all of the listed errors first shut down the connection and then reconnect before retrying.

  • MQRC_GET_INHIBITED
  • MQRC_BACKED_OUT
  • MQRC_CHANNEL_NOT_AVAILABLE
  • MQRC_CONNECTION_BROKEN
  • MQRC_HOST_NOT_AVAILABLE
  • MQRC_NOT_AUTHORIZED
  • MQRC_Q_MGR_NOT_AVAILABLE
  • MQRC_Q_MGR_QUIESCING
  • MQRC_Q_MGR_STOPPING
  • MQRC_UNEXPECTED_ERROR

Quick Start

Use this quick start to get up and running with the Confluent Cloud IBM MQ source connector. The quick start shows how to attach the connector to an IBM MQ broker, subscribe to the specified queue or topic, and stream data into Apache Kafka®.

Prerequisites
  • Kafka cluster credentials. The following lists the different ways you can provide credentials.
    • Enter an existing service account resource ID.
    • Create a Confluent Cloud service account for the connector. Make sure to review the ACL entries required in the service account documentation. Some connectors have specific ACL requirements.
    • Create a Confluent Cloud API key and secret. To create a key and secret, you can use confluent api-key create or you can autogenerate the API key and secret directly in the Cloud Console when setting up the connector.

Using the Confluent Cloud Console

Step 1: Launch your Confluent Cloud cluster

See the Quick Start for Confluent Cloud for installation instructions.

Step 2: Add a connector

In the left navigation menu, click Connectors. If you already have connectors in your cluster, click + Add connector.

Step 3: Select your connector

Click the IBM MQ Source connector card.

IBM MQ Source Connector Card

Step 4: Enter the connector details

Note

  • Make sure you have all your prerequisites completed.
  • An asterisk ( * ) designates a required entry.

At the Add IBM MQ Source Connector screen, complete the following:

Select the topic you want to send data to from the Topics list. To create a new topic, click +Add new topic.

Step 5: Check the Kafka topic

After the connector is running, verify that messages are populating your Kafka topic.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Using the Confluent CLI

Complete the following steps to set up and run the connector using the Confluent CLI.

Note

Make sure you have all your prerequisites completed.

Step 1: List the available connectors

Enter the following command to list available connectors:

confluent connect plugin list

Step 2: List the connector configuration properties

Enter the following command to show the connector configuration properties:

confluent connect plugin describe <connector-plugin-name>

The command output shows the required and optional configuration properties.

Step 3: Create the connector configuration file

Create a JSON file that contains the connector configuration properties. The following example shows the required connector properties.

{
  "connector.class": " IbmMQSource",
  "name": "IbmMQSource",
  "kafka.auth.mode": "KAFKA_API_KEY",
  "kafka.api.key": "<my-kafka-api-key>",
  "kafka.api.secret": "<my-kafka-api-secret>",
  "kafka.topic" : "data_topic_0",
  "output.data.format": "AVRO",
  "jms.destination.name": "<destination-name>",
  "mq.username": "<authorized-user>",
  "mq.password": "<user-password>"
  "mq.hostname": "<server-hostname>",
  "mq.queue.manager": <queue-name>",
  "tasks.max" : "1"
}

Note the following property definitions:

  • "name": Sets a name for your new connector.
  • "connector.class": Identifies the connector plugin name.
  • "kafka.auth.mode": Identifies the connector authentication mode you want to use. There are two options: SERVICE_ACCOUNT or KAFKA_API_KEY (the default). To use an API key and secret, specify the configuration properties kafka.api.key and kafka.api.secret, as shown in the example configuration (above). To use a service account, specify the Resource ID in the property kafka.service.account.id=<service-account-resource-ID>. To list the available service account resource IDs, use the following command:

    confluent iam service-account list
    

    For example:

    confluent iam service-account list
    
       Id     | Resource ID |       Name        |    Description
    +---------+-------------+-------------------+-------------------
       123456 | sa-l1r23m   | sa-1              | Service account 1
       789101 | sa-l4d56p   | sa-2              | Service account 2
    
  • "kafka.topic": The Kafka topic name where you want data sent.

  • "output.data.format": Supports AVRO, JSON, JSON_SR, and PROTOBUF. Schema Registry must be enabled to use a Schema Registry-based format.

  • "jms.destination.name": This is the name of the JMS destination (queue or topic) to read from.

  • "mq.username": Authorized user for the broker host. mq.password is required if not using additional connection security.

  • "mq.queue.manager": The IBM MQ queue manager.

  • "tasks.max": Enter the number of tasks in use by the connector. The connector supports multiple tasks. More tasks may improve performance.

Note

(Optional) To enable CSFLE for data encryption, specify the following properties:

  • csfle.enabled: Flag to indicate whether the connector honors CSFLE rules.
  • sr.service.account.id: A Service Account to access the Schema Registry and associated encryption rules or keys with that schema.

For more information on CSFLE setup, see Manage CSFLE for connectors.

Single Message Transforms: See the Single Message Transforms (SMT) documentation for details about adding SMTs. See Unsupported transformations for a list of SMTs that are not supported with this connector.

See Configuration Properties for all property values and definitions.

Step 4: Load the properties file and create the connector

Enter the following command to load the configuration and start the connector:

confluent connect cluster create --config-file <file-name>.json

For example:

confluent connect cluster create --config-file ibmmq-source.json

Example output:

Created connector  IbmMQSource_0 lcc-ix4dl

Step 5: Check the connector status

Enter the following command to check the connector status:

confluent connect plugin list

Example output:

ID          |    Name           | Status  |  Type
+-----------+-------------------+---------+-------+
lcc-ix4dl   |  IbmMQSource_0    | RUNNING | source

Step 6: Check the results on the broker.

After the connector is running, verify that messages are populating your Kafka topic.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Configuration Properties

Use the following configuration properties with the fully-managed connector. For self-managed connector property definitions and other details, see the connector docs in Self-managed connectors for Confluent Platform.

How should we connect to your data?

name

Sets a name for your connector.

  • Type: string
  • Valid Values: A string at most 64 characters long
  • Importance: high

Kafka Cluster credentials

kafka.auth.mode

Kafka Authentication mode. It can be one of KAFKA_API_KEY or SERVICE_ACCOUNT. It defaults to KAFKA_API_KEY mode.

  • Type: string
  • Default: KAFKA_API_KEY
  • Valid Values: KAFKA_API_KEY, SERVICE_ACCOUNT
  • Importance: high
kafka.api.key

Kafka API Key. Required when kafka.auth.mode==KAFKA_API_KEY.

  • Type: password
  • Importance: high
kafka.service.account.id

The Service Account that will be used to generate the API keys to communicate with Kafka Cluster.

  • Type: string
  • Importance: high
kafka.api.secret

Secret associated with Kafka API key. Required when kafka.auth.mode==KAFKA_API_KEY.

  • Type: password
  • Importance: high

Which topic do you want to send data to?

kafka.topic

Identifies the topic name to write the data to.

  • Type: string
  • Importance: high

Schema Config

schema.context.name

Add a schema context name. A schema context represents an independent scope in Schema Registry. It is a separate sub-schema tied to topics in different Kafka clusters that share the same Schema Registry instance. If not used, the connector uses the default schema configured for Schema Registry in your Confluent Cloud environment.

  • Type: string
  • Default: default
  • Importance: medium

Output messages

output.data.format

Sets the output Kafka record value format. Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON. Note that you need to have Confluent Cloud Schema Registry configured if using a schema-based message format like AVRO, JSON_SR, and PROTOBUF

  • Type: string
  • Default: JSON
  • Importance: high

IBM MQ Secure Connection

mq.tls.protocol

The TLS protocol version for secure connections to IBM MQ. The default is TLSv1.2, which should be fine for most cases, though the actual set of allowed values will depend on the JVM. Recent JVMs support TLSv1.3 and TLSv1.2, TLSv1.1 and TLS. Older JVMs may support SSL, SSLv2 and SSLv3, but these versions are disabled due to known security vulnerabilities.

  • Type: string
  • Default: TLSv1.2
  • Importance: medium
mq.tls.keystore.type

The file format of the key store file. This is required only when using secure TLS communication with IBM MQ. For MQ on Cloud queue managers of version 9.2.1 revision 2 and above, TLS is enabled by default

  • Type: string
  • Default: JKS
  • Importance: medium
mq.tls.keystore.location

The key store file. This is required only when using secure TLS communication with IBM MQ.

  • Type: password
  • Importance: high
mq.tls.keystore.password

The store password for the key store file. This is optional for client and only needed if TLS Keystore file is configured.

  • Type: password
  • Importance: high
mq.tls.key.password

The password of the private key used for secure TLS communication with IBM MQ.

  • Type: password
  • Importance: high
mq.tls.truststore.type

The file format of the trust store file. This is required when using TLS and secure communication with IBM MQ.

  • Type: string
  • Default: JKS
  • Importance: medium
mq.tls.truststore.location

The trust store file. This is required only when using secure TLS communication with IBM MQ.

  • Type: password
  • Importance: high
mq.tls.truststore.password

The password for the trust store file. If a password is not set access to the truststore is still available, but integrity checking is disabled. This is required only when using secure TLS communication with IBM MQ.

  • Type: password
  • Importance: high
mq.tls.keymanager.algorithm

The algorithm used by key manager factory for SSL connections. Default value is the key manager factory algorithm configured for the Java Virtual Machine. This is required only when using secure TLS communication with IBM MQ.

  • Type: string
  • Default: SunX509
  • Importance: low
mq.tls.trustmanager.algorithm

The algorithm used by trust manager factory for SSL connections. Default value is the trust manager factory algorithm configured for the Java Virtual Machine. This is required only when using secure TLS communication with IBM MQ.

  • Type: string
  • Default: PKIX
  • Importance: low
mq.tls.secure.random.implementation

The SecureRandom PRNG implementation to use for SSL cryptography operations. By default, tries PKCS11 implementation first. If PKCS11 is not supported, iterates through the provider and returns the first working implementation. This is required only when using secure TLS communication with IBM MQ.

  • Type: string
  • Importance: low

IBM MQ Session

jms.destination.name

The name of the JMS destination (queue or topic) to read from.

  • Type: string
  • Importance: high
jms.destination.type

The type of JMS destination, which is either queue or topic.

  • Type: string
  • Default: queue
  • Importance: high
max.pending.messages

The maximum number of messages per task that can be received from JMS brokers and produced to Kafka before the task acknowledges the JMS session/messages. If the task fails and is restarted, this is the maximum number of JMS messages the task may duplicate in Kafka.

  • Type: int
  • Default: 2000
  • Valid Values: [0,…,20000]
  • Importance: high
max.poll.duration

The maximum amount of time each task can build a batch. The batch is closed and sent to Kafka if not enough messages are read during the time allotted. This helps limit connector lag when the JMS queue/topic has a lower throughput.

  • Type: int
  • Importance: low
character.encoding

The character encoding to use while receiving the message.

  • Type: string
  • Default: UTF-8
  • Importance: low
jms.subscription.durable

Whether the subscription of the connector tasks to a JMS topic is durable or not. Durable subscriptions require a subscription name to be set via jms.subscription.name.

  • Type: boolean
  • Importance: medium
jms.subscription.name

The name of the JMS subscription. Supported only in durable subscriptions (jms.subscription.durable = true) and is applicable only to JMS topics.

  • Type: string
  • Importance: medium
jms.message.selector

The JMS message selector that should be applied to messages in the destination.

  • Type: string
  • Importance: high

IBM MQ Connection

mq.username

The username to use when connecting to IBM MQ.

  • Type: string
  • Importance: high
mq.password

The password to use when connecting to IBM MQ.

  • Type: password
  • Importance: high
mq.configuration.mode

The mode in connector is to configure single mq instance or multiple for HA/DR support

  • Type: string
  • Default: single
  • Importance: high
mq.hostname

IBM MQ broker host

  • Type: string
  • Importance: high
mq.port

IBM MQ broker port

  • Type: int
  • Default: 1414
  • Importance: high
mq.connection.list

For IBM’s HA/DR support with multiple MQ instances, enter hosts as comma-separated values, e.g., host1:port1, host2:port2.

  • Type: string
  • Importance: high
mq.queue.manager

The name of the queue manager.

  • Type: string
  • Importance: high
mq.channel

The channel for client connections.

  • Type: string
  • Default: “”
  • Importance: high
mq.ssl.cipher.suite

The CipherSuite for SSL connections.

  • Type: string
  • Default: “”
  • Importance: high
mq.ssl.fips.required

Whether SSL FIPS is required.

  • Type: boolean
  • Importance: high
mq.ssl.peer.name

Sets a distinguished name (DN) pattern. If sslCipherSuite is set, this pattern can ensure that the correct queue manager is used. The connection attempt fails if the distinguished name provided by the queue manager does not match this pattern.

  • Type: string
  • Default: “”
  • Importance: high

Number of tasks for this connector

tasks.max

Maximum number of tasks for the connector.

  • Type: int
  • Valid Values: [1,…]
  • Importance: high

Next Steps

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL Demo. This example also shows how to use Confluent CLI to manage your resources in Confluent Cloud.

../_images/topology.png