Get messages history

207 views
Skip to first unread message

Dana Keydar

unread,
Aug 24, 2022, 5:21:52 AM8/24/22
to nats
Hi, 
How can I view all published messages of a stream ? (after they were acknowledged)

Lucas Eduardo

unread,
Aug 24, 2022, 7:15:29 AM8/24/22
to nat...@googlegroups.com
AFAIK those are not stored by default 

Em qua., 24 de ago. de 2022 06:21, Dana Keydar <keyda...@gmail.com> escreveu:
Hi, 
How can I view all published messages of a stream ? (after they were acknowledged)

--
You received this message because you are subscribed to the Google Groups "nats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to natsio+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/natsio/6a739990-fcf1-4635-a659-bf5d95037939n%40googlegroups.com.

derek

unread,
Aug 24, 2022, 8:35:31 AM8/24/22
to nats
If you are speaking of JetStream, it depends on the streams retention policy. If limits based, then messages are not removed when ack'd by a consumer and can be replayed with a new consumer at will.

The NATS cli can do this with nats stream <stream> view

If the stream is a workqueue stream or has interest policy retention then messages can be removed when all registered consumers ack a given message sequence.

Dana Keydar

unread,
Aug 24, 2022, 9:48:26 AM8/24/22
to nats
Sorry. yes I'm speaking of JetStream.
I'm using js_WorkQueuePolicy and I would like to view all history messages only for monitoring purposes.
When runnin the nats cli command "nats stream <stream> view " i'm getting the following error :
nats: error: multiple non-filtered consumers not allowed on workqueue stream (10099)

derek

unread,
Aug 24, 2022, 10:03:53 AM8/24/22
to nats
WorkQueues can only have one consumer (but many apps that pull messages from that consumer for horizontal scalability).
Once a message is acked it is removed from the stream.

What you could do is create a mirror of the main workqueue stream with limits policy vs workqueue or interest policy and monitor from that stream all requests etc.

Dana Keydar

unread,
Aug 29, 2022, 7:55:45 AM8/29/22
to nats
You mean I need to create another stream with limits policy and each time a message is added to the main stream I should add it to the second stream as well ?

Alberto Ricart

unread,
Aug 29, 2022, 10:19:31 AM8/29/22
to nats
The consumer filter subjects cannot overlap in a workqueue. This means that if your stream hosts the subjects foo and bar, you can have:
- two consumers one that subscribes to `foo` and another that subscribes to `bar`
- one consumer that subscribes to `*`.

if you create a mirror stream with a non workqueue policy, you can have any number of consumers on it (they are independent) as the state for the consumer is kept by the consumer. On the workqueue the state of the consumer is the workqueue.

Dana Keydar

unread,
Aug 31, 2022, 3:05:13 AM8/31/22
to nats
My question was regarding the mirror stream solution , just wanted to make sure I'm not missing something and by saying mirror stream you meant that I need to create another stream with limits policy and each time a message is added to the main stream I should add it to the second stream as well .
Reply all
Reply to author
Forward
0 new messages