Skip to content
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

Nats improvement 1545 #1556

Merged
merged 4 commits into from
Jul 1, 2024

Conversation

davidterins
Copy link
Contributor

Description:

With these changes a consumer of the DotNetCore.CAP.NATS nuget package can opt out from allowing a NATS Consumer client to create topics and streams dynamically which enforces each client to be granted "admin" like permissions. To avoid assigning these permissions to each client, a consumer of the nuget package can now opt out from this by specifying NATSOptions property EnableSubscriberClientStreamAndSubjectCreation to false (defaults to true).

Issue(s) addressed:

Changes:

  • Added new NATSOptions property EnableSubscriberClientStreamAndSubjectCreation and usage of it in NatsConsumerClient.FetchTopics method.
  • Added call to OnLogCallback with MqLogType.ConnectError in order to mark the ConsumerRegister as "unhealthy" to allow "subscribe retries" calls to the NatsConsumerClinet.Subscribe method in case the server have not yet configured the expected stream before the client tries to subscribe.

Affected components:

  • DotNetCore.CAP.NATS

How to test:

  1. Start a nats server (with no configured streams)
  2. Start application with a cap subscriber on a specific subject/topic
    Configured with NatsOptions EnableSubscriberClientStreamAndSubjectCreation: false
  3. The client will fail to subscribe since the expected stream does not yet exist.
  4. Configure the nats server with expected streams and topics expected by application in step 2
  5. The application should subscribe to the now configured streams and topics.

Checklist:

  • I have tested my changes locally
  • I have added necessary documentation (if applicable) (xml summary on public api)
  • I have updated the relevant tests (if applicable) (No existing tests for CAP)
  • My changes follow the project's code style guidelines

Reviewers:

Copy link
Member

@yang-xiaodong yang-xiaodong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yang-xiaodong yang-xiaodong merged commit 7b6b033 into dotnetcore:master Jul 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants