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.
Procedure
-
Create a topic to consume ETL and transform map consumer messages.
-
Use the following command to create a topic in Hermes.
In this example, the topic name is topic2.
bin/kafka-topics.sh --create --command-config config/bootcamp.properties --bootstrap-server <instance name>.service-now.com:4000,<instance name>.service-now.com:4001,<instance name>.service-now.com:4002, <instance name>.service-now.com:4003 --topic snc.<instance name>.topic2
Be
sure to replace
<instance name> with the name of your instance.
-
To view the topic, log in to the instance and navigate to .
Note: It takes approximately 10 minutes to create a topic.
-
Create an ETL Consumer to consume data from the topic.
-
Navigate to .
-
Select New.
-
On the Kafka Consumer form, enter a name in the Name field.
This example uses the name Member Import.
-
For the Robust import set transformer filed, select an existing Robust import set transformer.
For the robust import set transformer, select one that is not using the option to store data in a single column. To be able to see the messages, make sure the robust import set transformer has the
Verbose option enabled.
-
Deselect the Data in single column option.
This option should only be selected for import set tables with data in a single column.
-
Set the Column mapping to Label.
This means the input message's JSON keys are mapped to the column labels of the Import Set table.
-
Save the form.
-
Create a Kafka stream for the consumer.
-
On the Kafka Stream form, set the following field values.
-
Select the Activate link under Related Links.
You should be able to see the activated subscription.
-
Publish messages to topic2.
-
Run the following command to publish messages to topic2.
bin/kafka-console-producer.sh --topic snc.<instance name>.topic2 --producer.config config/bootcamp.properties --bootstrap-server <instance name>.service-now.com:4000,<instance name>.service-now.com:4001,<instance name>.service-now.com:4002,<instance name>.service-now.com:4003
Be sure to replace <instance name> with the name of your instance.
This command prompts you for messages.
-
Send the following JSON message.
{"city":"San Diego","name":"Jhon","id":"SN001","state":"California"}
You can send this message with any values, but the JSON message key should match the Import Set table labels.
-
Navigate back to the ETL Consumer you created.
After about one minute, the data should have been imported through the import set.
-
To view detailed information about the import set, select the import set number.
-
To view detailed information about an import set row, select the import set row number.
-
Create a Transform Map Consumer to consume data.
-
Navigate to .
-
Select New.
-
On the Kafka Transform Map Consumer form, enter a name in the Name field.
-
For the Transform Map field, select an existing transform map.
-
Save the form.
-
Create a Kafka stream for the consumer.
-
On the Kafka Stream form, set the following field values.
-
Select the Activate link under Related Links.
You should be able to see the activated subscription.
-
Publish messages to topic2.
-
Run the following command to publish messages to topic2.
bin/kafka-console-producer.sh --topic snc.<instance name>.topic2 --producer.config config/bootcamp.properties --bootstrap-server <instance name>.service-now.com:4000,<instance name>.service-now.com:4001,<instance name>.service-now.com:4002,<instance name>.service-now.com:4003
Be sure to replace <instance name> with the name of your instance.
This command prompts you for messages.
-
Send the following JSON message.
{"city":"San Diego","name":"Jhon","id":"SN001","state":"California"}
You can send this message with any values, but the JSON message key should match the Import Set table labels.
-
Go to the Transform Map Consumer you created.
After about one minute, the data should have been imported through the import set.
-
To view detailed information about the import set, select the import set number as in step 3d above.