I am setting up an Azure LogicApp to read messages from a storage queue and POST the message to an API endpoint:
The LogicApp triggers as expected and logs a successfull run. I can see my queue message is removed from the queue but it is then placed back into the queue because the LogicApp did not process the for each loop and did not run the DeleteMessage step I have within the loop.
When I look at the Run History the OUTPUTS area shows the message in the When there are messages in a queue step but the Get Messages (V2) step does not show that there were any QueueMessages to process in its OUTPUTS:
I also observed the message was dequeued and returned with an increased dequeue count property after the LogicApp ran.
Why would the first step dequeue a message? Wouldn't it just check to see if any messages exist without pulling them? If it was step 2 that pulled it then why do I not see any messages in the OUTPUT?
How can I process my queue messages properly? I would like to pull them in batches of 32 (which is the max amount) and process them in the For each loop.
CodePudding user response:
Why would the first step dequeue a message? Wouldn't it just check to see if any messages exist without pulling them? If it was step 2 that pulled it then why do I not see any messages in the OUTPUT?
The trigger When there are messages in a queue (V2) return s the messages that are present in the queue and that the reason why you coundn't able to see the messages in Get Messages
action.
For your requirement, you can use the Message Text
of When there are messages in a queue (V2)
connector when you want to trigger each time when a message is pushed into the queue.
NOTE: This flow triggers for every message in the queue and sends messages a number of times to your API endpoint.
How can I process my queue messages properly? I would like to pull them in batches of 32 (which is the max amount) and process them in the For each loop.
Whereas if you want to get them as a batch of 32 then you can use any trigger other than When there are messages in a queue (V2)
and then use the Get Messages
action.
If you are confined to using only Storage Queue Connector, then you can use When a specified number of messages are in a given queue (V2), else a simple HTTP trigger would be enough to just trigger the logic app.
RESULT: