Closed Andras-Csanyi closed 4 years ago
You might want to take a look at Rebus.Async, which is a "synchronous API" for Rebus (in quotes, because it's actually Task
-based and async
, but it's synchronous in the sense that it can send a request and wait for a corresponding reply.
With it, your controller will be able to do something like this:
SomeReply reply = await _bus.SendRequest<SomeReply>(new SomeRequest());
Hi,
I have been struggling integrating request/reply pattern into my WebApi controllers. Following the example here, the controller is the producer and there is a workerservice as consumer. The problem I face to is that, the controller doesn't wait (this is the right thing, but gives me problems) for the worker to finish and publish its task, so the controller returns with null. Remembering what I did with NServiceBus a few years ago, we need a callback function here. But, I haven't found anything similar in the samples.
The case:
My question, do we have any callback functionality in Rebus, similar to NServiceBus, or I should use Saga for this purpose? Or what is the right thing to do? If its possible I don't want to go to CQRS direction, because SignalR will come into picture which is another complexity. (TBH I might already overengineered the whole stuff :D, but it is a pet project, in this case overengineering is kind of the right thing to do :D )