Skip to content
Theory · NATS JetStream · lesson 6 of 8

Publish deduplication and KV

A producer published an order, the stream stored it, but the publish acknowledgement got lost in the network. js.Publish returned an error, and the producer published again. Now the stream holds two identical orders under different numbers, and the consumer will process both. For the second one not to be stored, the server has to recognize the repeat.

In this lesson

  • The Nats-Msg-Id header
  • Duplicate window
  • What deduplication does not cover
  • KV store
  • Common mistake
  • Key points