NATS Consume

NATS Consume

Certified

Consume NATS JetStream messages

Pulls messages from a JetStream subject with explicit acks and writes them to Kestra internal storage. Requires a stream matching the rendered subject; defaults: deliverPolicy=All, pollDuration=PT2S, batchSize=10. Stops when no messages, maxRecords, or maxDuration is reached.

yaml
type: io.kestra.plugin.nats.core.Consume

Consume messages from any topic subject matching the kestra.> wildcard, using user password authentication.

yaml
id: nats_consume_messages
namespace: company.team

tasks:
  - id: consume
    type: io.kestra.plugin.nats.core.Consume
    url: nats://localhost:4222
    username: nats_user
    password: "{{ secret('NATS_PASSWORD') }}"
    subject: kestra.>
    durableId: someDurableId
    pollDuration: PT5S
Properties
Min length1

Subject to consume

Rendered subject or wildcard the JetStream stream is bound to.

Min length1

URL to connect to NATS server

The format is (nats://)server_url: port. You can also provide a connection token like so: nats://token@server_url: port

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
Default10
Minimum>= 1

Batch size

Maximum messages fetched per pull; defaults to 10.

Credentials files authentification

DefaultAll
Possible Values
AllLastNewByStartSequenceByStartTimeLastPerSubject

Deliver policy

JetStream deliver policy; defaults to All.

Durable consumer name

Optional durable name to resume position between runs.

Max duration

Optional wall-clock duration after which polling stops.

Max records

Optional cap on total messages; stops once reached.

Plaintext authentication password

DefaultPT2S

Poll duration

Wait time per fetch; defaults to PT2S.

Start time

ISO-8601 date-time rendered and parsed to set the deliver start; ignored if null.

Token authentification

Plaintext authentication username

Messages consumed

Total acknowledged messages during this run.

Formaturi

Output file URI

Kestra internal storage URI of the ION file containing consumed messages.