MassTransit: run execute routing-sleep synchronously

554 Views Asked by At

I'm looking for how to execute routing-sleep in a blocking way.
I need to run routing-sleep from http request, not from mass-transit request/response and to return success in case all activities were finished and failure in case of activity failure.

I'm aware about subscriptions of the routing-sleep builder. The problem that called to IPublishEndpoint.Execute resolved immediately after the first activity endpoint is reached.

I followed this answer. For my case, it says the I need to post masstransit request to myself from ASP.Net controller.
Is there any better way to ensure where all activities can be completed ?

1

There are 1 best solutions below

2
Chris Patterson On

There is an example in the unit tests of using a Request proxy to execute a routing slip, and you'd just use the request client in your controller. It isn't documented, nor is it easy to understand if you aren't familiar with routing slips and MassTransit, but it sounds like what you're trying to do.

https://github.com/MassTransit/MassTransit/blob/develop/tests/MassTransit.Tests/Courier/RequestRoutingSlip_Specs.cs