
NATS Consume
CertifiedConsume NATS JetStream messages
NATS Consume
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.
type: io.kestra.plugin.nats.core.ConsumeExamples
Consume messages from any topic subject matching the kestra.> wildcard, using user password authentication.
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
subject *RequiredNon-dynamicstring
1Subject to consume
Rendered subject or wildcard the JetStream stream is bound to.
url *Requiredstring
1URL 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
batchSize Non-dynamicinteger
10>= 1Batch size
Maximum messages fetched per pull; defaults to 10.
creds string
Credentials files authentification
deliverPolicy string
AllAllLastNewByStartSequenceByStartTimeLastPerSubjectDeliver policy
JetStream deliver policy; defaults to All.
durableId string
Durable consumer name
Optional durable name to resume position between runs.
maxDuration string
Max duration
Optional wall-clock duration after which polling stops.
maxRecords integerstring
Max records
Optional cap on total messages; stops once reached.
password string
Plaintext authentication password
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
pollDuration string
PT2SPoll duration
Wait time per fetch; defaults to PT2S.
since string
Start time
ISO-8601 date-time rendered and parsed to set the deliver start; ignored if null.
token string
Token authentification
username string
Plaintext authentication username
Outputs
messagesCount integer
Messages consumed
Total acknowledged messages during this run.
uri string
uriOutput file URI
Kestra internal storage URI of the ION file containing consumed messages.