Monitor/inspect/intercept nats messages

68 views
Skip to first unread message

matt weiss

unread,
Aug 6, 2021, 12:21:22 PM8/6/21
to nats
Hey All,

We have been looking high and low to determine a best practice or a method to intercept a conversation between two applications communicating over nats.  There are lots of variables I understand.  is it nats or streaming or jetpack?

Since a channel is really a single direction to get the entire picture of a conversation one would really need to capture two channels and interlace the two channels to make a single conversation (much like a screen play where two people are conversing).

While watching 1 subscription is useful, it's only part of the conversation, and when messages are almost being sent at the same time it can be difficult to compare two logs and determine which one was sent first, second, third across channels.

Interested in what others are doing to capture this type of useful information for debugging applications.

Thanks,
Matt

Colin Sullivan

unread,
Aug 6, 2021, 5:46:00 PM8/6/21
to nats
Hi Matt,

I'd suggest JetStream.  I like the name JetPack, great name for a future feature/enhancement!

One way to do this would be to use request/reply patterns with known subjects.  For example the replier could listen on on "conversation.session1.requests" and use a reply subject of something like  "conversation.session1.replies".  The requestor would publish on "conversation.session1.requests" and listen for responses on "conversation.session1.replies".  "session1" is a placeholder to represent the unique conversation.

You could create a JetStream stream ingesting "conversation.>" which would save all conversations (dropping old ones based on your limits), and anytime you wanted to inspect a past conversation you could replay with a filter of "conversation.session1.*" to see both sides of conversation "session1", in order.  When caught up, you would see it in realtime.

Best regards,
Colin
Reply all
Reply to author
Forward
0 new messages