-
Notifications
You must be signed in to change notification settings - Fork 26
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
RabbitMQ queue and exchange setup #161
Comments
hey @ilijaNL! A queue per message type per service would look something like this: If this is the case, there'd be a few limitations that make it impractical for most use cases:
|
Thanks for your reply.
I made a small playground for rabbitmq what i mean by queue per handler per service: which can be reproduced here: http:https://tryrabbitmq.com/ |
I'm struggling to understand what use case this would solve. Perhaps if you have an example then it might illustrate what needs to be achieved and how the queue-per-message-type approach would solve this? I can share the perspective of how the transports are implemented - Services can be written from a DDD perspective and handle messages from multi-domain, single-domain or even just a single aggregate root. If we're just talking about a single aggroot, like say a product order, the message stream might be:
If this is processed using a single queue then all messages will be processed in order. This will be the case even if there's a service queue backlog. This is also the case if the messages arrive immediately after one-another and there are multiple instances of the service processing the queue. Contrast this to a queue-per-message-type. If a |
Thanks for your response. You are correct when we talk about commands. Commands indeed should arrive in and process in order, thus having one queue. However in most cases you never dispatch many related commands at a time. Looking at your example, you need some cheorgrafy/orchestration process. For example if you start with place order command, a event orderplaced is published and after that the payorder command will be send and so forth. Now let's talk about publishing events. A big drawback with having one queue per service is that it blocks all not related in the same queue. For example: Consider having queues per handler per service for events I don't see any drawbacks but only benefits. Perhaps you could give me some example where the event order (not commands) does matter? |
Thanks for the example. I totally agree with what you said here:
How you decide to group handlers into services really depends on your application. NServiceBus recommends the fewer message handlers per service the better. Personally, I've found it useful to have a dedicated service & queue just for workflow orchestration. This avoids the issue of message backlogs delaying "next steps". Beyond that, I might start with one service per domain and if a message type is causing delays then it can be shaved off into a dedicated service and scaled independently. If you find that a queue-per-handler with multiple handlers per service is best for you, you should be able to start multiple instances of the bus - each with a single handler. I haven't personally done this but I imagine it should be fine all things considered. |
Thanks for reply! Yes starting multiple instances is a possibility, didn't think about that, thanks! Talking about nservicebus, is the exchange and queue setup compared to nservicebus implementation for the rabbitmq transporter? |
It's the same fanout pub/sub model as in NServiceBus, though from memory their implementation makes use of a database to polyfill some limitations around RabbitMQ like retry backoffs etc that this library doesn't yet have |
Thanks for your explanation, I will try this package to see if this can be implemented in our system for messaging |
Hello I just found out about this repo and this is what nodejs (typescript) ecosystem is currently missing for EDA however I have few questions about the RabbitMQ implementation.
Currently if I am looking at the implementation, the rabbitmq transporter creates exchanges per message type and one queue per service. I wonder why it is chosen for this kind of setup and not a queue per messagetype per service. E.g.:
service 1 has 2 handlers for event A and event B and service 2 has handler for event A and event C which now results in 2 queues. However why not creating service1.A, service1.B , service2.A and service2.C queues instead? This also makes it easier to deal with
bus/packages/bus-rabbitmq/src/rabbitmq-transport.ts
Line 221 in 0aad404
The text was updated successfully, but these errors were encountered: