Example Configurations

The following sections require running Apache Kafka® and Connect. For more information, see the Tutorial: Moving Data In and Out of Kafka. Note that as of Confluent Platform 7.5, ZooKeeper is deprecated for new deployments. Confluent recommends KRaft mode for new deployments. For more information, see the KRaft documentation page.

Note

The following configuration examples show the JmsSourceConnector connector class. If you plan to use a shared subscription (that is, "jms.subscription.shared": "TRUE") which requires the jms.client.id configuration property, you would use the extended connector class io.confluent.connect.weblogic.WeblogicSourceConnector.

Standalone

The first configuration is used typically along with standalone mode:

name=connector1
tasks.max=1
connector.class=io.confluent.connect.jms.JmsSourceConnector
# The following values must be configured.
kafka.topic=MyKafkaTopicName
jms.destination.name=MyQueueName
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://<host>:7001
connection.factory.name=MyConnectionFactory
# The following define the information used to validate the license stored in Kafka.
confluent.license=
confluent.topic.bootstrap.servers=localhost:9092

Change the confluent.topic.* properties as required to suit your environment. Leave the confluent.license property blank for a 30 day trial. See the configuration options for more details.

For example, the following configuration specifies how to look up the Weblogic connection information (check your Oracle Weblogic console and documentation for details).

name=connector1
tasks.max=1
connector.class=io.confluent.connect.jms.JmsSourceConnector
# The following values must be configured.
kafka.topic=MyKafkaTopicName
jms.destination.name=MyQueueName
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://<host>:7001
java.naming.security.principal=MyUserName
java.naming.security.credentials=MyPassword
connection.factory.name=MyConnectionFactory

# The following define the information used to validate the license stored in Kafka.
confluent.license=
confluent.topic.bootstrap.servers=localhost:9092

Distributed

This configuration is typically used along with distributed mode. Write the following JSON example to connector.json, configure all the required values, and use the command below to post the configuration to one of the distributed connect workers.

{
  "name": "connector1",
  "config": {
    "connector.class": "io.confluent.connect.jms.JmsSourceConnector",
    "kafka.topic":"MyKafkaTopicName",
    "jms.destination.name":"MyQueueName",
    "java.naming.factory.initial":"",
    "java.naming.provider.url":"",
    "connection.factory.name":,"",
    "confluent.license":"",
    "confluent.topic.bootstrap.servers":"localhost:9092"
  }
}

Change the confluent.topic.* properties as required to suit your environment. If running on a single-node Kafka cluster you will need to include confluent.topic.replication.factor=1. Leave the confluent.license property blank for a 30 day trial; otherwise, specify the Confluent license key. See Confluent Platform license options for more details.

For example, the following specifies how to look up the Weblogic connection information (for more details, refer to the documentation on connecting with JNDI and How to Lookup a Destinations) to create a durable subscription to a JMS topic.

{
 "name": "connector1",
 "config": {
   "connector.class": "io.confluent.connect.jms.JmsSourceConnector",
   "kafka.topic":"MyKafkaTopicName",
   "java.naming.factory.initial": "weblogic.jndi.WLInitialContextFactory",
   "jms.destination.name":"MyWeblogicTopic",
   "jms.destination.type":"topic",
   "java.naming.provider.url": "t3://<host>:7001/",
   "connection.factory.name": "com.oracle.webservices.api.jms.ConnectionFactory",
   "confluent.license": "",
   "java.naming.security.principal": "weblogic",
   "java.naming.security.credentials": "welcome1",
   "tasks.max" : "1",
   "jms.subscription.durable": true,
   "jms.subscription.name": "sub1",
   "confluent.topic.bootstrap.servers":"localhost:9092"
   }
}

Change the confluent.topic.* properties as required to suit your environment. If running on a single-node Kafka cluster you must include "confluent.topic.replication.factor":"1". Leave the confluent.license property blank for a 30 day trial. See Confluent Platform license options for more details.

Use curl to post the configuration to one of the Kafka Connect Workers. Change http://localhost:8083/ to the endpoint of one of your Kafka Connect worker(s).

curl -s -X POST -H 'Content-Type: application/json' --data @connector.json http://localhost:8083/connectors