Bosch IoT Device Management

How to deal with Kafka connections and events?

Bosch IoT Device Management uses Apache Kafka to ensure reliable message delivery. Every new subscription has its Kafka connection automatically configured and ready to go. See Auth for forwarding device data via connections.

However, users with older subscriptions or users who have deleted their Kafka connection for any reason would need to create a new connection manually and request the relevant signature. This would allow them to receive Kafka events in Bosch IoT Manager. Read on to learn how to create the connection and how to request the signature from our support team.

If you have a recent subscription of Bosch IoT Device Management, none of the following steps should be necessary

How can I create a manual Kafka connection?

In September 2020 when Bosch IoT Manager introduced Apache Kafka for its event broker, any already existing Device Management subscriptions had to follow these steps to be able to receive Kafka events:

Go to the Bosch IoT Things HTTP API, Solutions section.

By default, any changes there can be made with your Bosch User and apiToken authentication, unless the solution policy has been changed so as to authorize another user for that as well.

Find the method POST /solutions/{solutionId}/connections

In it use the following request body:

{
"name": "Device Management",
"connectionType": "kafka",
"connectionStatus": "open",
"uri": "ssl://msk-01.eu1.bosch-iot-suite.com:9991",
"targets": [
{
"address": "{PREFIX}.things2di/{{ thing:id }}",
"topics": [
"_/_/things/twin/events"
],
"authorizationContext": [
"integration:{SOLUTION_ID}:iot-manager"
],
"headerMapping": {
"service-instance-id": "{SERVICE_INSTANCE_ID}",
"correlation-id": "{{ header:correlation-id }}"
}
}
],
"specificConfig": {
"bootstrapServers": "msk-01.eu1.bosch-iot-suite.com:9991,msk-01.eu1.bosch-iot-suite.com:9992,msk-01.eu1.bosch-iot-suite.com:9993",
"saslMechanism": "PLAIN"
}
}

In the request body, replace {PREFIX}, {SOLUTION_ID} and {SERVICE_INSTANCE_ID} with:

{PREFIX} - for free plans replace it with Shared, whereas for paid plans replace it with the Service Instance ID as described below

{SERVICE_INSTANCE_ID} - the Service Instance ID of the respective subscription for which the connection is being made

{SOLUTION_ID} - The Bosch IoT Things Solution ID, which you can find on the Things Dashboard (see screenshot)

images/confluence/download/attachments/1634789581/dm_di_solution_id_things_dashboard.png

or on the Service Subscriptions page after clicking Show Credentials (see screenshot).

images/confluence/download/attachments/1634789581/dm_di_credentials.png

Why am I having trouble receiving Kafka events?

As of January 2021, in order to receive Kafka events properly, you would need a signature specific to your service instance ID.

Such a signature is automatically set up for every subscription of Bosch IoT Device Management with an available Kafka connection, so no further action is required by such users.

You can check whether you have such a signature by going to the Developer Console > Connections section > Device Management connections. Select the the Kafka 2.x Connection type:

images/confluence/download/attachments/1634790774/dm_faq_signature_coonnectionType.png

Then scroll down to the Targets section as you see on the screenshot below:

images/confluence/download/attachments/1634790774/dm_faq_signature.png

However, if you are creating a new connection via Bosch IoT Things manually and your service instance is older, as explained in the first section above, you will not have automatically the correct header and signature, therefore Kafka events will not be received properly.

For this reason, after the new Kafka connection has been created via Bosch IoT Things, you should contact our support team at support@bosch.io and request a service instance signature.

Our team will generate the correct signature and forward it to the things service, which will set it up to your specific service instance.