Kafka Endpoint
Kafka Endpoint is used to create and start Kafka subscription service, which can subscribe to different topic data, and then route it to different rule chains for processing.
TIP
This component is an extension component, and you need to import an additional extension library: [rulego-components]
# Type
kafka
# Startup configuration
Field | Type | Required | Description | Default |
---|---|---|---|---|
Brokers | []string | Yes | Kafka server address list | - |
# Response
Before exchange.Out.SetBody
responds, you need to specify the topic
parameter through exchange.Out.Headers()
, and the component will respond to the specified topic data:
exchange.Out.Headers().Add("topic", "device.msg.response")
exchange.Out.SetBody([]byte("ok"))
1
2
2
Response parameter configuration:
Field | Type | Required | Description | Default |
---|---|---|---|---|
topic | string | Yes | Topic | - |
partition | int | No | Partition | 0 |
key | string | No | Partition Key | - |
# Examples
The following are example codes using endpoint:
Edit this page on GitHub (opens new window)
Last Updated: 2024/06/16, 16:49:02