0

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 ?

LopDev
  • 823
  • 10
  • 26

1 Answers1

0

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

Chris Patterson
  • 28,659
  • 3
  • 47
  • 59
  • Thanks, Worked for me. I see that it is based on subscriptions, Completed and Faulted subscriptions are added by base class. In case im subscribing to RoutingSlipEvents.All then completed and Faulted events are fired twice. Is that by design? – Slava Fiodorov Jul 08 '20 at 05:33
  • If you create an additional subscription, then yes, you would get the message twice since there is already a subscription. – Chris Patterson Jul 08 '20 at 11:59