kafka
The kafka source receives inputs from Kafka.
The kafka source consumes kafka topics and turns messages into inputs for fns. It will make a message as consumed only if the fn returns an output successfully.
fnrunner Key
fnrun.source/kafka
Configuration
The following table describes the keys on the configuration object for the kafka source. Configuration data is required because the source will not know how to connect to Kafka without at least the brokers and topics.
Key | Type | Default | Description |
---|---|---|---|
brokers | String | "" | A comma-delimited list of broker addresses |
group | String | "" | The consumer group name |
version | String | 2.1.1 | The kafka version |
topics | String | "" | A comma-delimited list of topics to consume |
assignor | String | range | The rebalance strategy; one of sticky , roundrobin , and range |
oldest | Bool | false | Indicates whether the source should start with the oldest available message for a partition |
ignoreErrors | Bool | false | Indicates whether messages are marked as consumed when the fn returns an error |
Inputs
Inputs generated by the http source are objects with the following keys.
Key | Type | Description |
---|---|---|
key | String | The message key |
value | String | The message value |
offset | Integer | The message offset |
partition | Integer | The partition from which the message was received |
topic | String | The topic from which the message was received |
timestamp | Timestamp | The inner message timestamp |
Examples
The following example shows a system that consumes messages from a topic called
test-topic
and processes the event value with a bash script. Note that the
message will be marked as received only if the script returns successfully.
source:
fnrun.source/kafka:
brokers: 127.0.0.1:9092
group: fnrun-example
topics: test-topic
middleware:
- fnrun.middleware/key: value
fn:
fnrun.fn/cli:
command: ./fn.sh
script: true