rebus-org / Rebus.AzureServiceBus

:bus: Azure Service Bus transport for Rebus
https://mookid.dk/category/rebus
Other
33 stars 20 forks source link

feat(subscribers): opt to not create subscriptions #95

Closed riezebosch closed 1 year ago

riezebosch commented 1 year ago

fix #94

Rebus is MIT-licensed. The code submitted in this pull request needs to carry the MIT license too. By leaving this text in, I hereby acknowledge that the code submitted in the pull request has the MIT license and can be merged with the Rebus codebase.

ecw1973 commented 1 year ago

just discovered this PR when I was about to create one. I just made similar changes as I need this feature as well because our service bus is enterprise wide and is treated as a managed resource where creation of new topics/queues/subscriptions is done via IaC and requires going through an approval process.

ecw1973 commented 1 year ago

FYI, I discovered Rebus works as-is (i.e. using DoNotCreateQueues().DoNotCheckQueueConfiguration()) as long as you do not make any Subscribe calls. I was using common code for multiple service bus namespaces (some of which do not allow manage) and this was my issue.

mookid8000 commented 1 year ago

What does this PR actually do? You can easily avoid creating/interrogating subscriptions by avoiding making any calls to

await bus.Subscribe<TEvent>();
// and
await bus.Unsubscribe<TEvent>();

as well as their generic siblings

var topics = bus.Advanced.Topics;

await topics.Subscribe("some-topic");
// and
await topics.Unsubscribe("some-topic");
riezebosch commented 1 year ago

But do I then still receive any messages? Oh, sure do as long as they are forwarded to the queue for sure 🤦🏻 .