wagslane / go-rabbitmq

A wrapper of streadway/amqp that provides reconnection logic and sane defaults
https://blog.boot.dev/golang/connecting-to-rabbitmq-in-golang-easy/
MIT License
752 stars 126 forks source link

Direct reply-to #135

Closed thibleroy closed 11 months ago

thibleroy commented 1 year ago

Hello!

Is there a way to implement Direct Reply-to feature using this library? To do so, we have to reuse the same channel for consuming and publishing messages on RPC client side. As chanManager is private, I guess it is not possible to reuse previously created channels with the library, am I wrong?

LucaWolf commented 11 months ago

Interesting use case but no, it does not seem possible, both new publisher and new consumer create their own NewChannelManager. On tho other hand RPC over rabbit seems a bit strange and it goes against their own recommendation of having separate channels for publishing/consuming. What if your RPC have very high throughput, would TCP blocking be an issue? How long does the server take to process the request? How's the RPC completion reliability implemented when either the client, rabbit or the server goes down? I reckon these are all valid questions for reconsidering the scope of RPC over rabbit or if RPC is required in the first place. Overall RPC would be probably better served by other means. Alternatively, one can always create a proper (and auto-managed by e.g. this library) reply queue and expand their RPC protocol with the metadata (which reply queue to use, client ID, request sequence number) so clients wont step on each other's toes. This also has the advantage of the possibility of using topic queues for grouping "RPC".

wagslane commented 11 months ago

Closing as not possible