logicapps: Unexpected number of runs for trigger "When one or more messages arrive in a queue (peek-lock)"

Describe the Bug with repro steps

  1. Create a new Stateful workflow and use the Service Bus trigger (Not the in app version) for either “When one or more messages arrive in a queue (peek-lock)” or “When one or more messages arrive in a topic (peek-lock)”, the bug is the same for both.
  2. Leave default settings, i.e. split on = true and concurrency = off.
  3. Use Managed Identity (system assigned) to connect to the service bus.
  4. Set the maximum message count to a low value, in this case 2.
  5. Set the recurrence frequency to day and interval to 10 (high enough so it does not mess with the test.
  6. Create an action which completes the message.
  7. Add 10 messages to the queue.
  8. Run the trigger (twice… since the first one often does not fire in the portal)

Before running trigger Message count in the queue equals: 10 Max deliver count: 2

Expected result Number of triggers fired: 1. Number of history runs: 2. Message count in the queue after the run should be: 8.

Actual result Number of triggers fired: 16. Number of history runs: 10. Message count in the queue after the run equals: 0.

The bug is the same for: “When one or more messages arrive in a queue (peek-lock)” “When one or more messages arrive in a topic (peek-lock)”. My colleagues have the same problem.

This used to work when using Logic Apps Comsumption.

What type of Logic App Is this happening in?

Standard (Portal)

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Complete_the_message_in_a_queue": {
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "servicebus-2"
                        }
                    },
                    "method": "delete",
                    "path": "/@{encodeURIComponent(encodeURIComponent(parameters('serviceBusQueueName')))}/messages/complete",
                    "queries": {
                        "lockToken": "@{triggerBody()?['LockToken']}",
                        "queueType": "Main",
                        "sessionId": ""
                    }
                },
                "runAfter": {},
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_one_or_more_messages_arrive_in_a_queue_(peek-lock)": {
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "servicebus-2"
                        }
                    },
                    "method": "get",
                    "path": "/@{encodeURIComponent(encodeURIComponent(parameters('serviceBusQueueName')))}/messages/batch/head/peek",
                    "queries": {
                        "maxMessageCount": 2,
                        "queueType": "Main",
                        "sessionId": "None"
                    }
                },
                "recurrence": {
                    "frequency": "Day",
                    "interval": 10
                },
                "splitOn": "@triggerBody()",
                "type": "ApiConnection"
            }
        }
    },
    "kind": "Stateful"
}

Screenshots or Videos

Queue Settings QueueSettings QueueProperties

Queue Before Run BeforeRunningTrigger_ServiceBusExplorer

Workflow Trigger Before Manual Run BeforeRunningTrigger_LogicAppTriggerHistory BeforeRunningTrigger_LogicAppRunHistory

Workflow Trigger After Manual Run AfterRunningTrigger_LogicAppTriggerHistory AfterRunningTrigger_LogicAppRunHistory

Queue After Run AfterRunningTrigger_ServiceBusExplorer_Expected_8_Left

Browser

Microsoft Edge

Additional context

No response

AB#24933340

AB#24937486

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

There is a documentation gap on that, we will consider to improve it. To be precise, the maxMessageCOunt is not something which gets changed in this case, that is still honored. The connector will try to get messages <= maxMessageCount from the service bus, if it gets messages it will try to get more in the next trigger run. You should be able to use concurrency in this case, This is currently not supported for the built-in triggers, but can be used with managed API connection. As we speak we are currently working on providing the concurrency support in the built-in trigger as well.

If you want to use the peek-lock trigger with complete that is what is required as of now, it is designed such that cause of the constraint from service bus SDK to use the same receiver to complete the message which has picked up the message.

Hi @MrRosendahl, thanks for reporting your issue in detail, this appears to be a backend bug so I’m going to move this over to the repo that our backend devs keep an eye on for triage