Unable to get message queue from Azure Service Bus in Logic App environment

Lee Yong Sheng 41 Reputation points
2022-06-23T08:38:18.093+00:00

Hi Azure community

Greetings from Singapore!
I am currently using Logic App and Service bus to develop an email notification feature upon some conditions are satisfied.
The architecture diagram is as follows and attached:
214256-architecture.jpg

The Logic App will send out an email when some conditions are satisfied.
The Logic app sequence is as follows:
214259-logicapp-2.jpg

Based on the architecture, I think the Function App data processing and Service bus configuration is properly setup as I am able to view the message in peek mode in Azure Service Bus Explore portal:
214260-messagepeekmode-1.jpg

However, the message body in Logic App environment is empty [] when I was using "Get messages from a queue (peek-lock)" connector.
214262-logicapp-1.jpg

I am wondering if the logic app flow is not properly programmed.
From my knowledge, message queue generated by function app as output binding is peek-lock type by default.
I am also able to peek the message inside Service Bus Explorer, so that I use peek-lock connector in Logic App environment.

I attached the text file contains the logic app code view.
Thank you for the community help in advance!

Warmest regards
Yong Sheng

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Kamlesh Kumar 3,866 Reputation points
    2022-06-23T16:28:14.15+00:00

    Hi @Lee Yong Sheng ,

    Thank you for asking this question on the Microsoft Q&A Platform.

    You are getting empty value because of missing "SessionId" input,

    214358-image.png

                "Get_messages_from_a_queue_(peek-lock)": {  
                    "inputs": {  
                        "host": {  
                            "connection": {  
                                "name": "@parameters('$connections')['servicebus']['connectionId']"  
                            }  
                        },  
                        "method": "get",  
                        "path": "/@{encodeURIComponent(encodeURIComponent('testtopic'))}/messages/batch/peek",  
                        "queries": {  
                            "maxMessageCount": 20,  
                            "queueType": "Main",  
                            "sessionId": "@triggerBody()?['SessionId']"  
                        }  
                    },  
                    "runAfter": {},  
                    "type": "ApiConnection"  
                }  
    

    I tried to replicate it at my end and it's working fine for me, please refer the above code,

    214377-image.png

    Regards,
    Kamlesh Kumar
    BizTalk Techie

    Please don't forget to click on 205836-130616-image.png or upvote 205759-130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is How

    Want a reminder to come back and check responses? Here is how to subscribe to a Notification

    If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators


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.