NATS Core - Custom Inbox Prefix on a per-message basis? #1740
Replies: 1 comment
-
How custom do you want it to be? Could you share some examples of the usage you are looking for? You can implement request/response in NATS fairly easily and customize the inbox as you want: https://github.com/nats-io/nats.go/blob/main/nats.go#L4139-L4156 That approach (old style approach) is heavy in the subscription interest graph though, the built-in nats request/response handler tries to mitigate that by having a single subscription muxing all the responses on a single one looking like this by default: |
Beta Was this translation helpful? Give feedback.
-
tl;dr: is it feasible to have something akin to:
I'm trying to determine whether NATS (Core) Request-Reply "Inbox Prefix" functionality is possible to use on a per-message basis, with my goal being dynamically being able to set the message prefix on a per-request basis.
Based on
nats-cli
(--inbox-prefix
) andnats.go
(nats.CustomInboxPrefix()
) the custom inbox prefix is coupled on the NATS Connection itself.Obviously there are some work-arounds (hacks) I could attempt to workaround this limitation, but I thought it made more sense to ask if this is an intentional protocol design decision? or whether it could be justified to move the custom message prefix logic against messages rather than the connection.
References:
Beta Was this translation helpful? Give feedback.
All reactions