
Apache Kafka Consume
CertifiedRead Kafka records into internal storage
Apache Kafka Consume
Read Kafka records into internal storage
Consumes from configured topics or regex with manual offset commits (auto-commit disabled) and committed-only reads by default.
Writes all fetched records to Kestra internal storage as ION at uri and returns the count.
Defaults: pollDuration PT5S, STRING deserializers, Avro logical type converters enabled.
Use groupType: CONSUMER (default, backward compatible) for classic consumer groups, or groupType: SHARE for queue semantics with share groups and explicit acknowledgements.
In SHARE mode, topic and groupId are required, and topicPattern, partitions, and since are not supported.
Use since, maxRecords, maxDuration, or header filters to stop early.
type: io.kestra.plugin.kafka.ConsumeExamples
Consume data from a Kafka topic
id: kafka_consume
namespace: company.team
tasks:
- id: consume
type: io.kestra.plugin.kafka.Consume
topic: test_kestra
properties:
bootstrap.servers: localhost:9092
serdeProperties:
schema.registry.url: http://localhost:8085
keyDeserializer: STRING
valueDeserializer: AVRO
schemaRegistryVendor:
type: io.kestra.plugin.kafka.registry.ConfluentSchemaRegistry
schemaRegistryUrl: http://localhost:8085
Connect to a Kafka cluster with SSL.
id: kafka_consume
namespace: company.team
tasks:
- id: consume
type: io.kestra.plugin.kafka.Consume
properties:
security.protocol: SSL
bootstrap.servers: localhost:19092
ssl.key.password: "{{ secret('SSL_KEY_PASSWORD') }}"
ssl.keystore.type: PKCS12
ssl.keystore.location: my-base64-encoded-keystore
ssl.keystore.password: "{{ secret('SSL_KEYSTORE_PASSWORD') }}"
ssl.truststore.location: my-base64-encoded-truststore
ssl.truststore.password: "{{ secret('SSL_TRUSTSTORE_PASSWORD') }}"
topic:
- kestra_workerinstance
keyDeserializer: STRING
valueDeserializer: STRING
Consume data from a Kafka topic and write it to a JSON file
id: consume_kafka_messages
namespace: company.team
tasks:
- id: consume
type: io.kestra.plugin.kafka.Consume
topic: topic_test
properties:
bootstrap.servers: localhost:9093
auto.offset.reset: earliest
pollDuration: PT20S
maxRecords: 50
keyDeserializer: STRING
valueDeserializer: JSON
- id: write_json
type: io.kestra.plugin.serdes.json.IonToJson
newLine: true
from: "{{ outputs.consume.uri }}"
Consume only records whose headers match
id: consume_with_headers
namespace: company.team
tasks:
- id: consume_filtered
type: io.kestra.plugin.kafka.Consume
topic: orders
properties:
bootstrap.servers: localhost:9092
auto.offset.reset: earliest
keyDeserializer: STRING
valueDeserializer: JSON
headerFilters:
event-type: order_created
region: us-east
Consume queue-style with Kafka share groups
id: consume_kafka_share_group
namespace: company.team
tasks:
- id: consume_queue
type: io.kestra.plugin.kafka.Consume
topic: orders
properties:
bootstrap.servers: localhost:9092
groupId: orders-share-group
groupType: SHARE
acknowledgeType: ACCEPT
keyDeserializer: STRING
valueDeserializer: JSON
Properties
properties *Requiredobject
acknowledgeType string
ACCEPTACCEPTRELEASEREJECTRENEWAcknowledgement action for SHARE group type
Used only when groupType is SHARE.
ACCEPT (default) marks a record as processed, RELEASE returns it to the queue, REJECT negatively acknowledges it,
and RENEW extends the acquisition lock timeout for the current delivery attempt without changing record state.
Ignored when groupType is CONSUMER.
groupId string
Kafka consumer group ID
Determines offset management; required when using topicPattern and mandatory for groupType: SHARE (share group).
groupType string
CONSUMERCONSUMERSHAREGroup protocol to consume with
CONSUMER (default) keeps backward-compatible Kafka consumer-group behavior.
SHARE enables Kafka share-group queue semantics with explicit acknowledgements.
In SHARE mode, groupId and topic are required, and topicPattern, partitions, and since are not supported.
headerFilters object
Filter messages by Kafka headers
Consume records only when all header key/value pairs match exactly (last header wins, UTF-8 comparison)
keyDeserializer string
STRINGSTRINGINTEGERFLOATDOUBLELONGSHORTBYTE_ARRAYBYTE_BUFFERBYTESUUIDVOIDAVROJSONPROTOBUFDeserializer used for the key
Default STRING. Options: STRING, INTEGER, FLOAT, DOUBLE, LONG, SHORT, BYTE_ARRAY, BYTE_BUFFER, BYTES, UUID, VOID, AVRO, JSON.
maxDuration string
Maximum duration to wait before stopping
Soft limit checked on each poll.
maxRecords integerstring
Maximum records to consume before stopping
Soft limit checked on each poll.
onSerdeError Non-dynamic
Behavior on serde error
Applies when valueDeserializer is JSON: SKIPPED (default), STORE to internal storage, or DLQ to the configured topic.
io.kestra.plugin.kafka.KafkaConsumerInterface-OnSerdeError
Topic used when type is DLQ
SKIPPEDSKIPPEDDLQSTOREAction to take on serde error
partitions array
Specific partitions to consume
Manually assign partitions; bypasses consumer group rebalancing.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
pollDuration string
PT5SHow often to poll for records
Maximum wait per poll when no records are available.
schemaRegistryVendor Non-dynamic
Schema registry vendor
AWS Glue Schema Registry
Consume AVRO data from a Kafka topic using AWS Glue Schema Registry
id: consume-kafka-messages
namespace: company.team
tasks:
- id: consume
type: io.kestra.plugin.kafka.Consume
topic: topic_test
properties:
bootstrap.servers: localhost:9093
auto.offset.reset: earliest
pollDuration: PT20S
maxRecords: 50
keyDeserializer: STRING
valueDeserializer: AVRO
schemaRegistryVendor:
type: io.kestra.plugin.kafka.registry.AwsGlueSchemaRegistry
region: us-east-1
# endpoint, accessKey, secretKey are optional when using IAM roles
accessKey: "{{ secret('AWS_ACCESS_KEY_ID') }}"
secretKey: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
The AWS region where the schema registry is located
The AWS access key ID. Optional when using IAM roles or environment credentials
The AWS Glue Schema Registry endpoint. Optional when using IAM roles or standard regional endpoints
The AWS secret access key. Optional when using IAM roles or environment credentials
Confluent Schema Registry
Consume data from a Kafka topic with Confluent Schema Registry
id: consume-kafka-messages
namespace: company.team
tasks:
- id: consume
type: io.kestra.plugin.kafka.Consume
topic: topic_test
properties:
bootstrap.servers: localhost:9092
pollDuration: PT20S
maxRecords: 50
keyDeserializer: STRING
valueDeserializer: AVRO
schemaRegistryVendor:
type: io.kestra.plugin.kafka.registry.ConfluentSchemaRegistry
schemaRegistryUrl: http://localhost:8081
The Confluent Schema Registry URL
serdeProperties object
{}Serializer or deserializer properties
Passed to serdes; avro.use.logical.type.converters is forced to true by default.
since string
Timestamp to start consuming from
ISO-8601 instant used when no consumer group offsets exist; ignored when a consumer group controls offsets.
topic Non-dynamicobject
Kafka topic(s) to consume from
String or list of strings; mutually exclusive with topicPattern.
topicPattern string
Regex pattern of topics to consume from
Subscribes to topics matching the pattern and receives dynamic partition assignments; mutually exclusive with topic.
valueDeserializer string
STRINGSTRINGINTEGERFLOATDOUBLELONGSHORTBYTE_ARRAYBYTE_BUFFERBYTESUUIDVOIDAVROJSONPROTOBUFDeserializer used for the value
Default STRING. Options: STRING, INTEGER, FLOAT, DOUBLE, LONG, SHORT, BYTE_ARRAY, BYTE_BUFFER, BYTES, UUID, VOID, AVRO, JSON.
Outputs
messagesCount integer
Number of messages consumed from a Kafka topic
uri string
uriURI of a file in Kestra's internal storage containing the messages
Metrics
records counter
recordsNumber of records consumed from Kafka topic.