Brighter icon indicating copy to clipboard operation
Brighter copied to clipboard

ASB - allow creating of topics/subscriptions to be optional

Open penderi opened this issue 5 years ago • 15 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Cloud hosting typically leaves infra concerns (topuic/subscription creation) to be outside of the scope of a component or service. Moreover reduced-rights deployment means attempts to create will fail.

Add the ability to ASB transport to only create topics and subscriptions when specified. Default = allow (as current)

mentioned in #1438

penderi avatar Mar 18 '21 17:03 penderi

@penderi @iancooper I'll have a PR in for this in ~30 minutes

preardon avatar Mar 18 '21 18:03 preardon

@preardon Guessing you have seen the optional creation enum on the V9 publication and subscription?

iancooper avatar Mar 18 '21 18:03 iancooper

@iancooper I have not, I was just adding creation Booleans to AzureServiceBusConfiguration as I figured I would keep this confined to ASB Config. I can have a look to wire it up to the over arching config if you like

preardon avatar Mar 18 '21 18:03 preardon

@preardon So on Subscription https://github.com/BrighterCommand/Brighter/blob/master/src/Paramore.Brighter/Subscription.cs and Publication https://github.com/BrighterCommand/Brighter/blob/master/src/Paramore.Brighter/Publication.cs we have an enum OnMissingChannels that indicates what you want us to do:

  • Assume - don't validate or create, it's there trust me (low latency)
  • Validate - check its there, if not raise a channel failure
  • Create - create it

We assume for create producer creates channel (topic, routing key) but client creates queues etc.

That gets passed into your producer or consumer, and the code there has to do the work to determine what to do. When may vary. So with RMQ because it is a no-op if it exists and low-latency the Channel checks when it is called, but in AWS the ChannelFactory does it, not the Channel, because creation is high latency and we need to check if something exists before we create it.

So you have to think about where as well. I'm guessing that ASB is a REST API for creation, so it might make sense to look at the ChannelFactory in the same way AWS does

iancooper avatar Mar 18 '21 19:03 iancooper

  • @penderi and @preardon Please make sure you are talking so we don't have two folks trying to fix the same issue :-D

iancooper avatar Mar 18 '21 19:03 iancooper

@iancooper don't worry @preardon is a mate at Flagstone, all good.

penderi avatar Mar 18 '21 20:03 penderi

Let me know if you happy to close this now @iancooper

holytshirt avatar Mar 19 '21 00:03 holytshirt

@holytshirt Going to look shortly

iancooper avatar Mar 19 '21 09:03 iancooper

@holytshirt I just wanted to check on the following. Forwarding my comments from the PR:

@preardon So the only thing that might be missing is that the consumer doesn't check for the topic and create it if asked to create. I don't know enough about the management wrapper to know if that will automatically check for the topic and create it, if it is missing, but it would probably need that if not. The consumer tends to check for everything - the producer only the topic.

iancooper avatar Mar 19 '21 09:03 iancooper

If it subscription doesn't check for/auto-create the topic, we'll need a PR to fix that before we can close this issue.

iancooper avatar Mar 19 '21 09:03 iancooper

@iancooper I will have a look and report back

preardon avatar Mar 19 '21 10:03 preardon

@iancooper Have confirmed, does not AutoCreate Topic, PR Incoming

preardon avatar Mar 19 '21 12:03 preardon

Was doing some testing and found that I missed plumbing a part, PR incoming

preardon avatar Mar 27 '21 21:03 preardon

@iancooper Hey Mate, was looking deeper into this tonight, the error that ends up getting thrown on Channel Failure due to not Topic / Subscription Not existing ends up being "Could not receive message. Note that should return an MT_NONE from an empty queue on timeout" (MessagePump Line 89), Just wanted to get your opinion on this as while the original Error with reason gets swallowed, it'll be logged but there is no hint of the exact reason in the Final exception

preardon avatar Mar 27 '21 22:03 preardon

@iancooper I think we can close this

preardon avatar Apr 29 '21 21:04 preardon