Solace Sink Connector for Confluent Platform
The Kafka Connect Solace Sink connector is used to move messages from Apache Kafka® to a Solace PubSub+ cluster.
Note
If you are required to use the Java Naming and Directory Interface™ (JNDI) to connect to Solace,
there is a general JMS Sink Connector for Confluent Platform available that uses a
JNDI-based mechanism to connect to the JMS broker.
Prerequisites
The following are required to run the Kafka Connect Solace Sink Connector:
- Kafka Broker: Confluent Platform 3.3.0 or above, or Kafka 0.11.0 or above
- Connect: Confluent Platform 4.1.0 or above, or Kafka 1.1.0 or above (requires header support in Connect)
- Solace cluster with JMS 1.1 support
com.solacesystems:sol-jms
Client Library (See Installing the Solace JMS Client Library)
- Java 1.8
Install the Solace Sink Connector
You can install this connector by using the instructions or you can
manually download the ZIP file.
Install the connector using Confluent Hub
- Prerequisite
- Confluent Hub Client must be installed. This is installed by default with Confluent Enterprise.
Navigate to your Confluent Platform installation directory and run the following command to install the latest (latest
) connector version. The connector must be installed on every machine where Connect will run.
confluent-hub install confluentinc/kafka-connect-solace-sink:latest
You can install a specific version by replacing latest
with a version number. For example:
confluent-hub install confluentinc/kafka-connect-solace-sink:1.0.0-preview
Solace Client Library
The Kafka Connect Solace connector does not come with the Solace JMS client library.
If you are running a multi-node Connect cluster, the Solace connector and Solace JMS client JAR
must be installed on every Connect worker in the cluster. See below for details.
Installing the Solace JMS Client Library
This connector relies on a provided com.solacesystems:sol-jms
client JAR distributed by Solace.
The connector will fail to create a connection to Solace if you have not installed the JAR on each Connect worker node.
The installation steps are:
- Download the Solace JMS API. Additional versions are available on Maven.
- Unzip the download and copy only the
lib/sol-jms-{version}.jar
file into the share/java/kafka-connect-solace-sink
directory of your Confluent Platform installation on each worker node. If downloading the library from Maven, you do not need to unzip anything as the jar file is the only artifact downloaded.
- Restart all of the Connect worker nodes.
Note
The share/java/kafka-connect-solace-sink
directory mentioned above is for Confluent Platform.
If you are using a different installation, find the location of the Confluent Solace
sink connector JAR files and place the sol-jms
JAR file into the same directory.
Forwarding Kafka Properties to JMS
The connector can be configured to forward various values from the Kafka record to the JMS Message.
- Enable
jms.forward.kafka.key
to convert the record’s key to a String and forward it as the JMSCorrelationID
.
- Enable
jms.forward.kafka.metadata
to forward the record’s topic, partition, and offset on JMS Message properties.
- Kafka topic is applied to the message as a String property named
KAFKA_TOPIC
.
- Partition is applied to the message as an Int property named
KAFKA_PARTITION
.
- Offset is applied to the message as a Long property named
KAFKA_OFFSET
.
- Enable
jms.forward.kafka.headers
to add each header from the SinkRecord to the JMS Message as a String property.
Note
The connector converts the record key and headers to a sensible string representation
that is similar to the JSON representation, with the exception of simple string values (not in objects or arrays)
which are unquoted. No other conversion is done to the key and headers before forwarding them on the JMS Message.
If another format is needed, out-of-the-box or custom Single Message Transformation can be used
with the connector to transform the record keys and/or headers to the desired string representation
before the JMS sink connector processes each record.
Quick Start
This quick start uses the Solace Sink Connector to consume records from Kafka and send them to an Solace PubSub+ Standard broker.
Start a Solace PubSub+ Standard docker container.
docker run -d --name "solace" --hostname "solace" \
-p 8080:8080 -p 55555:55555 -p 5550:5550 \
--shm-size=1000000000 \
--tmpfs /dev/shm \
--ulimit nofile=2448:38048 \
-e username_admin_globalaccesslevel=admin \
-e username_admin_password=admin \
-e system_scaling_maxconnectioncount=100 \
solace/solace-pubsub-standard:9.1.0.77
Install the connector through the Confluent Hub Client.
# run from your CP installation directory
confluent-hub install confluentinc/kafka-connect-solace-sink:latest
Install the Solace JMS Client Library.
Start the Confluent Platform.
Tip
The command syntax for the Confluent CLI development commands changed in 5.3.0.
These commands have been moved to confluent local
. For example, the syntax for confluent start
is now
confluent local services start
. For more information, see confluent local.
confluent local services start
Produce test data to the sink-messages
topic in Kafka.
seq 10 | confluent local services kafka produce sink-messages
Create a solace-sink.json
file with the following contents:
{
"name": "SolaceSinkConnector",
"config": {
"connector.class": "io.confluent.connect.jms.SolaceSinkConnector",
"tasks.max": "1",
"topics": "sink-messages",
"solace.host": "smf://localhost:55555",
"solace.username": "admin",
"solace.password": "admin",
"solace.dynamic.durables": "true",
"jms.destination.type": "queue",
"jms.destination.name": "connector-quickstart",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.storage.StringConverter",
"confluent.topic.bootstrap.servers": "localhost:9092",
"confluent.topic.replication.factor": "1"
}
}
Load the Solace Sink Connector.
Caution
You must include a double dash (--
) between the topic name and your flag. For more information,
see this post.
confluent local services connect connector load solace --config solace-sink.json
Confirm that the connector is in a RUNNING
state.
confluent local services connect connector status solace
Navigate to the Solace UI to confirm the messages were delivered to the connector-quickstart
queue in the default
Message VPN.
Tip
The default credentials for the Solace Admin UI are admin
/admin