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:
1545
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:
Start a nats server (with no configured streams)
Start application with a cap subscriber on a specific subject/topic
Configured with NatsOptions EnableSubscriberClientStreamAndSubjectCreation: false
The client will fail to subscribe since the expected stream does not yet exist.
Configure the nats server with expected streams and topics expected by application in step 2
The application should subscribe to the now configured streams and topics.
Checklist:
[x] I have tested my changes locally
[x] 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)
[x] My changes follow the project's code style guidelines
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
tofalse
(defaults to true).Issue(s) addressed:
1545
Changes:
NATSOptions
propertyEnableSubscriberClientStreamAndSubjectCreation
and usage of it inNatsConsumerClient.FetchTopics
method.OnLogCallback
withMqLogType.ConnectError
in order to mark theConsumerRegister
as "unhealthy" to allow "subscribe retries" calls to theNatsConsumerClinet.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:
EnableSubscriberClientStreamAndSubjectCreation: false
Checklist:
Reviewers: