New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KV prefix handling #239
KV prefix handling #239
Conversation
…unt exports tests
…ream options will need to be propagated.
fixed use of createInbox where intended inboxPrefix was incorrectly set to the apiPrefix
…am prefixes are honored correctly by the KV, when specified on the jetstream options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few questions and a name change
@@ -398,7 +398,7 @@ export class JetStreamClientImpl extends BaseApiClient | |||
ErrorCode.ApiError, | |||
); | |||
} | |||
jsi.config.deliver_subject = createInbox(); | |||
jsi.config.deliver_subject = createInbox(this.nc.options.inboxPrefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this.nc.
does not have a create inbox function that makes use of the inbox Prefix automatically?
As is the case in go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no it doesn't - it is just a function. But anywhere it is called in the lib it is honored.
…ally (subject in the stream) to fullKeyName as per review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[FEAT] Properly support KV across accounts:
a sample server configuration:
In the above:
In ordered to access the KV, the client in
B
:inboxPrefix
toforb
(this will force NATS to know that subscription interest onforb.>
is required by accountB
and allow the ordered push consumer to work for watches and history.JetStreamClient
, setting the optionapiPrefix
tofroma
,JetStreamManager
requests to setup the KV, etc, will now flow to the account'sA
JetStream.A
.[CHANGE] internal Bucket.create now requires a JetStreamClient instead of a NatsConnection - this allows propagation of the JetStream options to the KV, which enables prefixes (from the NatsConnection) and
apiPrefix
from theJetStreamClient
to be properly honored by the Kv.[FIX] consumer options ignored
inboxPrefix
connection option when auto-generating an inbox for adeliverTo
, this, in turn, prevented things like watch/history from working on across accounts because in order to circumvent consumer issues across accounts a stream must be exported, and subscriber must use this prefix in order to receive messages. Possibly this is incorrect but requires current consumer across account strategy to be changed to pull (or at least support ordered pull consumers)[FIX] when re-creating an ordered consumer, the API prefix was incorrectly used as an inbox prefix.