Repository navigation
feat(events/natsjs): add NatsOptions to pass nats.Option values - #3
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The plugin builds its own nats.Options from a fixed set of fields. It cannot set JWT credentials, so it cannot connect to a NATS server that runs in operator (JWT) mode. The new option NatsOptions adds nats.Option values to the connection. The plugin applies them last, so they take precedence. Use it with nats.UserCredentials or nats.UserCredentialBytes for JWT credentials. Bump nats.go to v1.54.0 and go to 1.26.10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
6 tasks done
kobergj
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
events/natsjsplugin builds its ownnats.Optionsfrom a fixed set of fields. It cannot set JWT credentials. Thus it cannot connect to a NATS server that runs in operator (JWT) mode.This PR adds the option
natsjs.NatsOptions(...nats.Option). The plugin applies these values after all other options, so they take precedence. Use it withnats.UserCredentialsornats.UserCredentialBytesfor JWT authentication.reva (OCSRE-1629) uses this option to give
.credscredentials to the event streams.Changes
v4/events/natsjs: addNatsOptions.connectToNatsJetStreamapplies the values and returns an error when an option fails.v4/events/natsjs: addjwt_test.go. The test starts a NATS server in operator mode and checks these cases:v4/events/natsjs,v4/store/nats-js-kv: bumpnats.goto v1.54.0 andgoto 1.26.10.Tests
GOWORK=off go test ./...inv4/events/natsjs:TestNatsOptionsUserCredentialspasses.GOWORK=off go test ./...inv4/store/nats-js-kv: passes.TestSingleEventsometimes fails during theTempDircleanup. The same flaky behavior occurs on the base commit. This PR does not cause it.Follow-up
After the merge, reva must add a
replaceforgithub.com/go-micro/plugins/v4/events/natsjsto this fork. reva must also move thenats-js-kvreplace to the new commit.🤖 Generated with Claude Code