Kafka Send Message Activity
The Kafka Send Message activity is used to send or publish messages to consumers through Kafka brokers.
- In the application process, right-click and create a group named local transactions.
- Add the Kafka Send Message activity inside the newly created local transaction group.
- On the General tab of the local transaction, select Transaction Transport as Kafka.
- Add one or more Kafka Send Message activities which participates in the transaction inside Local Transaction group. Configure Transaction ID and ensure Enable Idempotence is selected.
Note: The Kafka Send Message activities (inside the transaction group) which are configured with the same shared resource and the Transaction ID participates in a transaction identified by the provided Transaction ID. In such cases, the Kafka producer instance is initialized in the first Kafka Send Message activity within the transaction group and the same producer instance is used by subsequent Kafka Send Message activities. The transaction gets committed or aborted as execution progress towards the end of transaction group.
Ensure that multiple Kafka Send Message activities participating in the same transaction should be configured with identical configuration. For example, if the first Kafka Send activity is using a string value serializer, then all subsequent activities should be configured with the string value serializer. However, partition or topic name can be provided differently for each activity.
General
On the General tab, you can specify the required parameters before you use this activity. The General tab contains the following fields:
Description
On the Description tab, you can enter a short description for the Send Message activity.
Advanced
The following table describes the fields on the Advanced tab of the Send Message activity.
Input
The following table describes the fields on the Input tab of the Send Message activity.
- If the property is not set or set to false, only one KafkaProducer is created in init() method when the application starts and the producer gets closed when the application stops.
- In the above case, topic from the Input tab is overridden. All other producer properties are derived from the General and Advanced tabs and the Input tab configurations are ignored.
- If the property is set to true, then properties specified in the Input tab override the properties in the General tab and Advanced tab, and a new KafkaProducer is created for every job.
Output
The following table describes the fields on the Output tab of the Send Message activity.
Output Item | Data Type | Description |
---|---|---|
KafkaSendMessageOutput | complex | The complete output of the Send Message activity. |
result | complex | Information about the content of the sent and failed messages. |
status | string | Status of the message sent by a producer. |
SendSuccess | complex | Information about the content of the sent message. |
topic | string | The topic name for publishing the message. |
offset | number | The sequence ID number assigned to each record within a partition. |
Partition | number | The sequence ID of the partition to which a record is sent within a topic. |
SendFailed | complex | Information about the content of the failed message. |
errorCode | string | Displays the error code. |
errorMessage | string | Displays the error message. |