Stream Connect quick start guide
This quick start guide gives you an overview of how to set up and use each of the six Stream Connect producers and consumers to exchange data between your ServiceNow instance and a Kafka environment.
- Kafka Producer step in Workflow Studio
- ProducerV2 API
- Kafka Message trigger in Workflow Studio
- Extract Transform Load (ETL) consumer
- Transform Map consumer
- Script consumer
To link your ServiceNow instance to a Kafka environment, Stream Connect uses the Hermes Messaging Service. The following diagram shows each of the producers and consumers and how they connect to your Kafka environment, shown here as the customer site, through Hermes.
For more information, see Using Stream Connect for Apache Kafka and the Hermes Messaging Service.
Getting started
To represent the customer site, this guide uses Apache Kafka command-line tools run in your computer. The configuration parameters used with this tool can be used to configure any client connection to the Application Delivery Controller, version 2 (ADCv2) gateway using the Kafka protocol.
All the given commands are tested with OpenSSL version (LibreSSL 2.8.3) and Apache Kafka binary distribution version kafka_2.13-3.4.0.tgz. However, all the commands should work with any version you have in your local environment.
Quick start steps
This quick start guide has five steps. Steps 1 and 2 cover how to set up and test a connection to Hermes. Steps 3 through 5 show you how to configure and use each of the Stream Connect producers and consumers to send and receive data.
- The ADCv2 gateway uses mutual authentication to authenticate requests, so the first step is to create a keystore and truststore to use with your favorite Kafka client. The following page shows you how to create the required certificates: Set up a secure connection to the Hermes Messaging Service.
- After you set up a secure connection to Hermes, verify the keystore and truststore have been correctly generated by Testing the connection to Hermes through the ADCv2 gateway.
- Now you can Use the Kafka Message trigger and Script consumer to consume messages. The first part of this page shows you how to use the Kafka Message trigger in Workflow Studio to retrieve messages from Kafka. The second part shows you how to use the Script consumer to retrieve messages.
- And Use the ETL and Transform Map consumers to import data. ETL definitions and transform maps specify the transformation logic to use when pulling data through scheduled imports. You can use the same ETL definitions and
transform maps to transform the events received through Kafka.Remarque :To use the ETL consumer, you need a robust import set transformer. Likewise, to use the Transform Map consumer, you need a transform map.
- Finally, you can Use the Kafka Producer step and the ProducerV2 API to publish messages. This page shows you how to use both the Kafka Producer step in Workflow Studio and the ProducerV2 API to push messages to Kafka.
Set up a secure connection to the Hermes Messaging Service
Secure your Kafka topics by generating a ServiceNow® instance-signed certificate.
Avant de commencer
Setting up the Hermes Messaging Service requires coordination with your network administrator and with your Kafka administrator. Work with your network administrator to obtain required security certificates and open the required ports. Work with your Kafka administrator to ensure that your Kafka environment is configured correctly and that your applications can connect to the Hermes Messaging Service using the standard Kafka protocol.
Make sure the following setup is in place:
- The Hermes Messaging Service is activated. See Activating the Hermes Messaging Service.
- The Key Management Framework plugin (com.glide.kmf.global) is activated.
- The Certificates [sys_kmf_certificate] table contains a ServiceNow instance root CA certificate.
- The instance isn't configured with a Custom URL. Custom URLs are not supported with the Instance PKI Certificate Generator.
Role required: hermes_admin, sn_kmf.cryptographic_manager, or admin
For details on assigning KMF roles, see Roles installed with Key Management Framework.
Procédure
Résultats
You can now create a secure connection to the Hermes Messaging Service.
Test the connection to Hermes through the ADCv2 gateway
Verify the keystore and truststore have been correctly generated by testing the connection to Hermes through the ADCv2 gateway.
Avant de commencer
- Role required: integration_hub_admin
Procédure
Use the Kafka Message trigger and Script consumer to consume messages
Retrieve messages from Hermes with the Kafka Message trigger in Workflow Studio and the Script consumer.
Avant de commencer
- Role required: integration_hub_admin
- The first part of this section shows you how to use the Kafka Message trigger in Workflow Studio to consume messages. For more information about the trigger, see Create a flow with a Kafka Message trigger.
- The second part of this section shows you how to use the Script consumer to consume messages. For more information, see Configure a script consumer.
Procédure
-
Create a topic to consume messages.
-
Create a flow trigger to consume messages from the topic.
-
Publish messages to the topic using the Kafka command-line tool.
-
Create a Script consumer to consume messages from the topic.
Use the ETL and Transform Map consumers to import data
Use ETL definitions and transform maps to process Kafka events. ETL definitions and transform maps specify the transformation logic to use when pulling data through scheduled imports. You can use the same ETL definitions and transform maps to transform the events received through Kafka.
Avant de commencer
- Role required: integration_hub_admin
- The first part of this section shows you how to use the ETL Consumer to consume messages. To use the ETL consumer, you need a robust import set transformer.
- The second part of this section shows you how to use a Transform Map consumer to consume messages. To use the Transform Map Consumer, you need a transform map.
Procédure
-
Create a topic to consume ETL and transform map consumer messages.
-
Create an ETL Consumer to consume data from the topic.
-
Publish messages to topic2.
-
Create a Transform Map Consumer to consume data.
-
Publish messages to topic2.
Use the Kafka Producer step and the ProducerV2 API to publish messages
Push data from ServiceNow to Hermes so that the Kafka consumers can read them.
Avant de commencer
- Role required: integration_hub_admin
- The first part of this section shows you how to use the Kafka Producer step in Workflow Studio to publish messages to Hermes. For more information about the step, see Kafka Producer step.
- The second part of this section shows you how to use the ProducerV2 API to publish messages. For more information, see ProducerV2 API.
- To receive all the messages, you need to run two consumers for different datacenters. See Consume test messages from a Hermes topic using the Kafka client for details.
Procédure
-
Start two consumers to receive messages.
-
Publish messages from the instance using a flow step.
-
Publish messages from the instance using a script.