Kafka Producer step
Summarize
Summary of Kafka Producer step
The Kafka Producer step is a Workflow Studio action step that allows ServiceNow users to publish events to a Kafka topic in their environment. This step requires theactiondesignerrole, a Stream Connect subscription, and the ServiceNow Stream Connect Installer plugin. It enables integration with Kafka by sending structured messages to specified topics, supporting event-driven workflows.
Show less
Key Features
- Topic Selection: Choose a Kafka topic from a drop-down list to publish messages, which organizes messages by type.
- Message Content: Define the message text to be published, which must comply with an optional selected schema structure.
- Partitioning via Key: Specify a key to ensure messages with the same key are stored in the same partition within a topic.
- Headers: Add name-value pair headers to messages, using static values or data pills for dynamic content.
- Wait For Completion: Optionally configure the flow to pause until the Kafka Producer step completes before proceeding.
- Schema Enforcement: Reference a schema table to validate the message structure before publishing.
- Error Handling: Choose whether to stop the action and evaluate errors or continue with subsequent steps if the Kafka Producer step fails. Error details are captured in the Step Status object.
Practical Use
Use this step to publish events such as incident creations or payment updates to Kafka topics, enabling real-time data streaming and integration with other systems. For example, sending an incident creation message with an incident ID as the key ensures related messages are partitioned together, facilitating efficient processing downstream.
Outputs
- Step Status Object: Contains runtime details including success or error codes and messages.
- Step Status Code: An integer where 0 indicates success and 1 indicates an error.
- Step Status Message: Provides descriptive error messages if the step fails.
Create an action that publishes events to a topic in your Kafka environment.
Roles and availability
The Kafka Producer step is an Workflow Studio action step. Users with the action_designer role can create a custom action with one or more action steps.
This step is requires a Stream Connect subscription. For more information, see https://www.servicenow.com/now-platform/workflow-data-fabric.html.
This step requires the ServiceNow Stream Connect Installer [com.glide.hub.stream_connect.installer] plugin.
Fields
| Field | Description |
|---|---|
| Topic | Name of the topic to publish the message to. A topic stores messages of the same type. For example, a topic named Payments might store messages about recent payments. Select a topic from the drop-down list. |
| Message | Text of the message. |
| Key | Name of the key for a specific partition. Topics can be partitioned. Messages with the same key are stored in the same partition. For example, payment messages with a key of June would all be stored in the same partition of the Payments topic. |
| Headers | Headers for the message, in name-value pairs. For both the Name and Value fields, you can enter a value or use a data pill. |
| Wait For Completion | Option to require the flow to wait for the step to complete before continuing. |
| Schema | Reference to a schema table. Select a schema from the list. For information on schemas, see . Note: The message you're sending in the Message field must adhere to the structure of the selected schema. |
| If this step fails | Option to go to error evaluation or continue running the next step. This
option has no effect on the Step Status. Select one of the following.
|
Example
In this example, the step sends a message recording the creation of an incident. The message includes an incident identifier, a description, and a message header. The message is sent to the incidents topic, and stored in the partition with the name of the incident identifier.
Outputs
| Field | Description | Data Type |
|---|---|---|
| Step Status | Object data pill containing runtime details about the step. Each step in an action returns a Step Status. | Object |
| Step Status > Code | Integer data pill indicating whether the step produced an error. By default, a value of 1 indicates that the step produced an error. A value of 0 indicates that the step ran successfully. You can't customize these codes. | Integer |
| Step Status > Message | String data pill containing the error message produced by the step or system operation. You can't customize this message. | String |