Search code examples
azureazureservicebusazure-servicebus-queuesazure-servicebus-subscriptions

Azure service bus, Auto forwarding does not wait to message completed


I want to use the auto-forwarding feature of the Azure service bus. I have a topic called "trip" and has a subscription called "test".

I have set the auto-forwarding enabled and set to forward the message to another Topic called "trip_elaborated". This is working fine. But, It does not wait for the message to complete and then auto-forward to another topic.

e.g the "test" subscription takes 30 seconds to process the message and before it completed it forwards the message to the "trip_elaborated" topic. I want this operation do in sync.

Is there any configuration needed? Or any other way to achieve this kind of scenario?

I would prefer to manage this using service bus explorer(without explicitly do in the consumer using code).


Solution

  • When Auto forwarding is enabled on an entity, messages will be forwarded automatically, and cannot be processed from the entity they were originally sent to. If you want to process the message and forward it in a synchronous manner, you'd need to do it in your processer. Azure service bus will forward the message from the subscription straight to the destination the moment the message arriving at the topic meets the filter criteria.

    To achieve processing and forwarding, you can process the incoming message in a transactional manner, something Azure Service Bus supports. See documentation for more details.

    In case you can tolerate processing and forwarding in parallel, you'd have two subscriptions, one for processing and another for solely auto-forwarding.