How to disable and enable message delivery with logic app

Raminder Chima 41 Reputation points
2021-02-28T23:12:54.433+00:00

Hi,
I am using Azure Service Bus Topic to deliver [push] message to client API end point using Service bus adapter in logic app. I have a use case where Client API can be down or due to network issue, API call can fail from logic app. Service bus will put message into dead letter queue after specified re-attempts. Now I want..
A. To suspend message delivery after 2 re-attempt and do not want to move message to dead letter queue. In fact when API endpoint is available, I want to restart from the left out message, message which was in front of the queue.
B. is there any other way except using Azure Function, to push message to API or Client can access [pull] Service bus endpoint using https, so that I don't have to use Logic Apps.

Thanks in advance for any help.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2021-03-01T07:05:55.303+00:00

    Hi @Raminder Chima

    Welcome to Microsoft Q&A! Thanks for posting the question.

    Once you have read the message from the service bus queue/subscription the delivery count will be increased by one and once it reaches the max delivery count value it will be moved to the dead letter queue (if you have set the configuration to move the message to the dead letter queue).
    There is no way to stop increment this count by one when every time you consume the message. The only way will be to increase this delivery count value to some high value but you need to verify if this fits with your business scenario.
    Alternatively, If you still want to go with this approach then your client should implement an API that will return you the status whether they are up or not. In your logic app, you can first call this API to check the status of your client whether it is up or not. If yes then you should consume the message from the service bus and push that message to your client API.

    The better way to handle this will be receiving these messages at your client API end by using event driven architecture. But to implement this you need to have a premium service bus SKU. You can create the event grid subscription and integrate it with your service bus. There are events Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners raised when there are active messages in a Queue or Subscription and no receivers listening. The event grid subscription will have the webhook endpoint as your client API. In your webhook, you can implement the logic to consume the message directly from the service bus queue/subscription.

    Update:

    Yes when you defer the message then that message will be deferred but the logic app will still get triggered for the new messages that will be sent to the service bus. There can be two ways:

    1. If you can change the logic app trigger from service bus trigger to timmer trigger to trigger your logic app. In your logic app, you will have an action that will check the status of your client API. If the API is up then you can call "get message from a topic subscription" and then complete the message once message processing is completed.
    2. If you still want to use service bus trigger but can create another application that will check the API status and based on the outcome will enable or disable the workflow using REST API's.

    Reference: https://learn.microsoft.com/en-us/azure/logic-apps/manage-logic-apps-with-azure-portal#disable-or-enable-logic-apps

    Hope the above helps. Feel free to get back to me if you have any queries or concerns.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.