JetStream

Detailed documentation on the NATS JetStream component

Component format

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

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: jetstream-pubsub
  5. namespace: default
  6. spec:
  7. type: pubsub.jetstream
  8. version: v1
  9. metadata:
  10. - name: natsURL
  11. value: "nats://localhost:4222"
  12. - name: name
  13. value: "connection name"
  14. - name: durableName
  15. value: "consumer durable name"
  16. - name: queueGroupName
  17. value: "queue group name"
  18. - name: startSequence
  19. value: 1
  20. - name: startTime # in Unix format
  21. value: 1630349391
  22. - name: deliverAll
  23. value: false
  24. - name: flowControl
  25. value: false

Spec metadata fields

FieldRequiredDetailsExample
natsURLYNATS server address URLnats://localhost:4222
nameNNATS connection name“my-conn-name”
durableNameNDurable name“my-durable”
queueGroupNameNQueue group name“my-queue”
startSequenceNStart Sequence1
startTimeNStart Time in Unix format1630349391
deliverAllNSet deliver all as Replay Policytrue
flowControlNFlow Controltrue

Create a NATS server

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

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

You can then interact with the server using the client port: localhost:4222.

Install NATS JetStream on Kubernetes by using the helm:

  1. helm repo add nats https://nats-io.github.io/k8s/helm/charts/
  2. 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.

Last modified November 12, 2021 : Merge pull request #1949 from willtsai/az-staticwebapp-versioning (c40e456)