The documentation you are viewing is for Dapr v1.4 which is an older version of Dapr. For up-to-date documentation, see the latest version.


Detailed documentation on the NATS JetStream component


To setup JetStream pubsub create a component of type pubsub.jetstream. See [this guide]( on how to create and apply a pubsub configuration.

kind: Component
  name: jetstream-pubsub
  namespace: default
  type: pubsub.jetstream
  version: v1
  - name: natsURL
    value: "nats://localhost:4222"
  - name: name
    value: "connection name"
  - name: durableName
    value: "consumer durable name"
  - name: queueGroupName
    value: "queue group name"
  - name: startSequence
    value: 1
  - name: startTime # in Unix format
    value: 1630349391
  - name: deliverAll
    value: false
  - name: flowControl
    value: false


字段 必填 详情 示例
natsURL Y NATS 服务器地址 URL nats://localhost:4222
name N NATS connection name "my-conn-name"
durableName N Durable name "my-durable"
queueGroupName N Queue group name "my-queue"
startSequence N Start Sequence 1
startTime N Start Time in Unix format 1630349391
deliverAll N Set deliver all as Replay Policy true
flowControl N Flow Control true


You can run a NATS Server with JetStream enabled locally using Docker:

docker run -d -p 4222:4222 nats:latest -js

然后,您可以使用 localhost:4222 与服务器进行交互。

Install NATS JetStream on Kubernetes by using the helm:

helm repo add nats
helm install my-nats nats/nats

This installs a single NATS server into the default namespace. To interact with NATS, find the service with: kubectl get svc my-nats.