Search code examples
azureservicebusmasstransitazure-servicebus-queuesconsumer

Masstransit - long running process and imediate response


I'm using Masstransit with Azure Service Bus, what I would like to achieve is to call bus from API with some request that will trigger a long process but also get an immediate response that request has been received.

What would be the best way to achieve that? Should I use JobConsumer and GetResponse with JobSubmissionAccepted or is there a better option?


Solution

  • If your consumer will take a long time, typically more than five minutes, using a Job Consumer is an option. However, you need to be aware of the additional requirements to run a job consumer.

    A regular consumer typically works fine up to the MaxAutoRenewDuration of the receive endpoint, so having the initial consumer produce a message that the subsequent consumer handles and then responding to the request immediately afterwards is a good option as well.