Replies: 2 comments 1 reply
-
Hey @gdoddsy. Best practice would be to have a queue per handler. Each handler should really only have one purpose. Brighter does support a single queue with multiple bindings to it that are handled by a single handler. However each binding has to be registered separately (one per routing key), so you're not gaining anything by not using separate queues. Also each handler can only handle one type of event. So each of your events would need to be of the same type for the handler to be registered. From what you've said this will not be the case.
This is perfectly fine, and pretty normal. We have around 300 queues across our system, each with it's own Event and Handler associated with it. |
Beta Was this translation helpful? Give feedback.
-
Follow up question, is it bad practice to have 1 event handler handle multiple different events? E.g. I want to do the same thing when either event a or event b happens. I was hoping to create event handler with a common base class that the 2 events would raise. The other option I see is to create the common event handler, but inherit that into 2 specific event handlers which control the subscription. I'm not sure if any of this makes sense, and if it does, I'm not sure if it's a good idea. Any thoughts, or anywhere you can point me to? |
Beta Was this translation helpful? Give feedback.
-
Some of our business processes go through a number of events to get from start to finish. Our hope was to use a single queue that would have multiple bindings to the Exchange, and then have a single subscription for multiple commands pick things off that queue and use the routing key to execute the correct Event Handler. Is that something that Brighter can do, or do you need to have a queue per Event Handler? This answer on Stack Overflow says that we'll need 1 queue per event handler.
Is there any documentation around this, or thoughts on best practices? We're going to end up with a few hundred queues if we have to create 1 queue per event handler, and we're not sure if that's a good thing or not.
Beta Was this translation helpful? Give feedback.
All reactions