Trigger
Consume messages periodically from Kafka topics and create one execution per batch.
Note that you don't need an extra task to consume the message from the event trigger. The trigger will automatically consume messages and you can retrieve their content in your flow using the {{ trigger.uri }}
variable. If you would like to consume each message from a Kafka topic in real-time and create one execution per message, you can use the io.kestra.plugin.kafka.RealtimeTrigger instead.
type: "io.kestra.plugin.kafka.Trigger"
id: kafka_trigger
namespace: company.team
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ trigger.value }}"
triggers:
- id: trigger
type: io.kestra.plugin.kafka.Trigger
topic: test_kestra
properties:
bootstrap.servers: localhost:9092
serdeProperties:
schema.registry.url: http://localhost:8085
keyDeserializer: STRING
valueDeserializer: AVRO
interval: PT30S
maxRecords: 5
groupId: kafkaConsumerGroupId
Kafka consumer group ID.
Using a consumer group, we will fetch only records that haven't been consumed yet.
How often to poll for a record.
If no records are available, the maximum wait duration to wait for new records.
The deserializer used for the value.
Possible values are: STRING
, INTEGER
, FLOAT
, DOUBLE
, LONG
, SHORT
, BYTE_ARRAY
, BYTE_BUFFER
, BYTES
, UUID
, VOID
, AVRO
, JSON
.
Interval between polling.
The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.
The deserializer used for the key.
Possible values are: STRING
, INTEGER
, FLOAT
, DOUBLE
, LONG
, SHORT
, BYTE_ARRAY
, BYTE_BUFFER
, BYTES
, UUID
, VOID
, AVRO
, JSON
.
The maximum duration to wait for new records before stopping the consumption process.
It's a soft limit evaluated every second.
The maximum number of records to fetch before stopping the consumption process.
It's a soft limit evaluated every second.
Topic partitions to consume messages from.
Manually assign a list of partitions to the consumer.
Kafka connection properties.
The bootstrap.servers
property is a minimal required configuration to connect to a Kafka topic.
This property can reference any valid Consumer Configs or
Producer Configs as key-value pairs.
If you want to pass a truststore or a keystore, you must provide a base64 encoded string for ssl.keystore.location
and ssl.truststore.location
.
Serializer configuration
Configuration that will be passed to serializer or deserializer. The avro.use.logical.type.converters
is always passed when you have any values set to true
.
Timestamp of a message to start consuming messages from.
By default, we consume all messages from the topics with no consumer group or depending on the configuration of the auto.offset.reset
property. However, you can provide an arbitrary start time.
This property is ignored if a consumer group is used.
It must be a valid ISO 8601 date.
List of execution states after which a trigger should be stopped (a.k.a. disabled).
Kafka topic(s) to consume messages from.
It can be a string or a list of strings to consume from one or multiple topics.
Kafka topic pattern to consume messages from.
Consumer will subscribe to all topics matching the specified pattern to get dynamically assigned partitions.
Number of messages consumed from a Kafka topic.
URI of a file in Kestra's internal storage containing the messages.