rebus-org / Rebus.RabbitMq

:bus: RabbitMQ transport for Rebus
https://mookid.dk/category/rebus
Other
65 stars 45 forks source link

RPC #64

Closed marrrschine closed 4 years ago

marrrschine commented 4 years ago

hi,

I have a question. Is there a way to implement RPC with Rebus? Thanks a lot!

mookid8000 commented 4 years ago

Both yes and no 🙂 Rebus has the Rebus.Async package, which enables writing code like this:

var request = new SomeRequest();

var reply = await _bus.SendRequest<SomeReply>(request);

but you are advised to avoid using asynchronous durable message queues for this kind of communication as much as possible, because it's using an asynchronous and durable middleware (i.e. message queues) to do something that is synchronous and transient in nature, so it's

and so on.

I recommend using JSON over HTTP or gRPC for all of your RPC needs.

With that said, Rebus.Async can definitely also be used. Just be aware that there are better ways of doing synchronous RPC. 🙂