Monday, July 26, 2021

Listen message from Azure Service Bus in Logic APP

 

In this blog, we are going to receive the message from the queue. We will try to receive the same message and other from the same queue that we pushed to service bus queue in last blog. After receiving the message, we will try to process it.

 



 

Mostly things we already have ready so let’s create a Logic app. This time it will be triggered from the service bus not HTTP.

 

Create a Logic APP:

 

  • We will follow the same process as we created multiple Logic APP so far. I am using again consumption-based Logic App and given “sb-queue-listener” name.

 

 



 

  • Click Review and Create.

 



  • Choose Trigger as “When Request is received in a Service Bus Queue”, as mentioned above.

 

  • We will see the below screen; we have already created a connection in last blog. If you have multiple connection use one which was used in earlier blog to push message in “logicapp-queue-demo” queue

 


 

  • Choose the Queue “logicapp-queue-demo” from the dropdown if you have multiple queue, it should automatically populated if connection is correct.

 



  • Use the frequency that how often logic App should look into the queue for a message. I have used default in every 3 min.

 



 

  • Click on “Next Step” to initialize a variable in which we will store the message received from the queue. Search variable in the search bar and select “variable” as highlighted.
  • Choose “Initialize Variable” as Action.



  •  Below screen will populate, where give the variable name as “sb_response”, select type as String and choose dynamic “Content” (from Service Bus) in “Value” section as illustrated below.


 

  • Save the Logic app and wait for 3 min. You can see that Logic App has been triggered as there was a message in the queue already. If message is not there in the queue then submit the message in the same queue by following the last blog, where we can submit message in “logicapp-queue-demo” queue from the POSTMAN tool.

 



 

  • You can also run the what happened with the logic app by clicking the Run History log.

 

  • You can also go to the service bus to verify that message is not there as processed by this Logic App.

 



 

 

No comments:

Post a Comment