Skip to main content
Version: 1.8.5

CREATING A KAFKA CONNECTION

Available since ThingPark X IoT Flow 1.7.1.

The Kafka connector publishes the uplinks of your devices to a topic of your Kafka cluster, and consumes another topic of the cluster to receive the downlinks.

The data follows this path: LoRaWAN® device → ThingPark Enterprise → ThingPark X IoT Flow connection → your Kafka cluster → your application.

Before you create the connection, you need a Kafka cluster reachable from ThingPark X IoT Flow, with the uplink and downlink topics already created.

Collecting Expected Information​

Parameters required

UI FieldDescription
NameName of the connection.
Bootstrap ServersList of the Kafka brokers to connect to, one entry per broker, for example broker1.mydomain.com:9092.
Uplink TopicTopic where the connector publishes the uplinks. This topic must already exist on the cluster.
Downlink TopicTopic where the connector receives the downlinks. This topic must already exist on the cluster.
Producer Client IDClient ID of the connector when it publishes to the Kafka cluster.
Consumer Client IDClient ID of the connector when it consumes from the Kafka cluster.
Consumer Group IDConsumer group ID of the connector when it consumes from the Kafka cluster.
ConcurrencyNumber of consumers used to subscribe to the topics.
Security ProtocolHow the connector secures the communication with the Kafka brokers: PLAINTEXT (default), SSL, SASL_PLAINTEXT or SASL_SSL. With SASL_PLAINTEXT and SASL_SSL, the form also asks for the SASL Mechanism (PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, GSSAPI or OAUTHBEARER), the SASL Username / Client ID and the SASL Password / Client Secret. With SSL and SASL_SSL, it asks for the Domain Certificate (X.509) that validates the identity of the brokers, and an optional Private Key for mutual TLS.
DescriptionOptional description of the connection.
Warning

The topics used by the connection must already exist on the Kafka cluster.

Creating a Connection With UI​

  1. In ThingPark Enterprise, click Connections -> + Add Connection -> ThingPark X IoT Flow. Add a ThingPark X IoT Flow connection in ThingPark Enterprise

  2. In ThingPark X IoT Flow, click Kafka in the list of connectors. Select the Kafka connector

  3. Fill in the form:

    • Name: a clear name for the connection, for example My Kafka Connection.
    • Bootstrap Servers: click + to add each broker of your cluster, with its port.
    • Uplink Topic: the topic of the uplinks, already created on the cluster.
    • Downlink Topic: the topic of the downlinks, already created on the cluster.
    • Producer Client ID: the client ID used to publish the uplinks.
    • Consumer Client ID: the client ID used to consume the downlinks.
    • Consumer Group ID: the consumer group ID used to consume the downlinks.
    • Concurrency: the number of consumers, for example 1.
    • Security Protocol: keep PLAINTEXT, or select the protocol of your cluster and fill in the fields it adds.
    • Description: optional. Set your Kafka connection
  4. Click Create. A notification confirms that the connection has been created, and the connection details open.

  5. In the connection details, check that the connection is OPENED (see Connection States).

Note

Parameters marked with * are mandatory.

Creating a Connection With API​

The creation of a connection establishes a bidirectional messaging transport link between ThingPark X IoT Flow and the broker.

To do this, you need to use the Connections group resource:

  • POST /connections to create a new Connection instance
  • PUT /connections to update a Connection instance
  • DELETE /connections to delete a Connection instance
Note

We follow the REST-full API pattern, when updating configuration properties for a connection resource. Thus, you must also provide the whole configuration again.

Example for creation of a new connection instance:

POST /connections
{
"connectorId":"actility-kafka-iot",
"name":"Kafka - Official",
"configuration":{
"bootstrapServers": "kafka1:9091,kafka2:9091,kafka3:9091",
"producerClientId": "actility-kafka-producer",
"consumerClientId": "actility-kafka-consumer",
"consumerGroupId": "actility-kafka-cg",
"uplinkTopic": "ActilityUplinkTopic",
"downlinkTopic": "ActilityDownlinkTopic",
"concurrency": 1
}
}

The following table lists the properties applicable to a connection instance.

JSON FieldDescription
connectorIdMust be set to actility-kafka-iot.
configuration/bootstrapServersThe Kafka brokers to connect to, separated by commas, for example broker1.mydomain.com:9092,broker2.mydomain.com:9092.
configuration/producerClientIdThe client ID used when connecting to the Kafka cluster to publish.
configuration/consumerClientIdThe client ID used when connecting to the Kafka cluster to consume.
configuration/consumerGroupIdThe consumer group ID used when connecting to the Kafka cluster to consume.
configuration/uplinkTopicThe topic to publish the uplinks to. This topic must already exist on the cluster.
configuration/downlinkTopicThe topic to consume the downlinks from. This topic must already exist on the cluster.
configuration/concurrencyThe number of consumers used to subscribe to the topics.
configuration/securityProtocolPLAINTEXT, SSL, SASL_PLAINTEXT or SASL_SSL.
Important note

All properties are not present in this example. You can check the rest of these properties in the common parameters section.

Associating Devices With the Connection​

In ThingPark Enterprise, open Devices, select a device, and add the connection to the Connections of the device. You can also select the connection when you create a device, or for many devices at once with a CSV file in Devices -> Bulk Operations.

Displaying Information to Know if It Worked​

Open a Kafka administration tool connected to your cluster. The uplink topic receives the uplinks of your devices, and the connector appears as a consumer of the downlink topic.

Uplink and downlink topics in a Kafka administration tool

Limitations​

There are currently no known limitations to the Kafka connector.

Troubleshooting​

There is no known issue with the Kafka connector.