For logic app consumption, using trigger "When a message is received in a topic subscription (peek-lock)", we see that some logic apps trigger "waiting runs", even though the max concurrency is set to a lower number.
Depending on how you save your logic app, even though the workflow JSON is the same, the logic app can behave differently.
Plan Type
Consumption
Steps to Reproduce the Bug or Issue
Doing testing and debugging, we see the following:
Test 1:
Create Logic app A
Add the service bus trigger (don't save yet)
Change the Concurrency Control to 5
Save (the first save after creating it).
Batch send more than 5 messages (example 12).
You can see that 5 running processes and 7 waiting state logic apps will be triggered.
We don't like these 7 waiting state runs, because they are causing other issues with lock token and session id.
Test 2:
Create logic app B
Add the service bus trigger (don't save yet)
Make sure that the Concurrency control, limit is off (default when creating).
Save
Go back to the logic app and change the Concurrency control to the same from test 1, limit on, Degree of parallelism 5.
Save
Batch send more than 5 messages (example 12).
Now you will see that only 5 running processes will be triggered, and only 5, no waiting processes. When one of them finishes, a new one starts. Make sure that only 5 running messages are running, and no in "waiting" state.
I want to point out that both logic app A and B, from the workflow JSON perspective, uses the same topic and sub, and the same service bus API connector, under the same resource group, location etc.
They are 100% the same, from the JSON view.
I want to make a very important note of what we tested:
If we copy the JSON logic app code between the logic apps A and B, we still see the issue on Logic app A, and not in Logic App B. Which is very strange.
Describe the Bug
For logic app consumption, using trigger "When a message is received in a topic subscription (peek-lock)", we see that some logic apps trigger "waiting runs", even though the max concurrency is set to a lower number.
Depending on how you save your logic app, even though the workflow JSON is the same, the logic app can behave differently.
Plan Type
Consumption
Steps to Reproduce the Bug or Issue
Doing testing and debugging, we see the following:
Test 1:
You can see that 5 running processes and 7 waiting state logic apps will be triggered. We don't like these 7 waiting state runs, because they are causing other issues with lock token and session id.
Test 2:
Now you will see that only 5 running processes will be triggered, and only 5, no waiting processes. When one of them finishes, a new one starts. Make sure that only 5 running messages are running, and no in "waiting" state.
I want to point out that both logic app A and B, from the workflow JSON perspective, uses the same topic and sub, and the same service bus API connector, under the same resource group, location etc.
They are 100% the same, from the JSON view. I want to make a very important note of what we tested: If we copy the JSON logic app code between the logic apps A and B, we still see the issue on Logic app A, and not in Logic App B. Which is very strange.
Workflow JSON
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Close_a_session_in_the_topic": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['servicebus']['connectionId']" } }, "method": "delete", "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topic')))}/subscriptions/@{encodeURIComponent(parameters('sub'))}/sessions/@{encodeURIComponent(triggerBody()?['SessionId'])}/close" }, "runAfter": { "Complete_the_message_in_a_topic_subscription": [ "Succeeded" ] }, "type": "ApiConnection" }, "Complete_the_message_in_a_topic_subscription": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['servicebus']['connectionId']" } }, "method": "delete", "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topic')))}/subscriptions/@{encodeURIComponent(parameters('sub'))}/messages/complete", "queries": { "lockToken": "@triggerBody()?['LockToken']", "sessionId": "@triggerBody()?['SessionId']", "subscriptionType": "Main" } }, "runAfter": { "Renew_lock_on_the_session_in_a_topic_subscription-copy-copy": [ "Succeeded" ] }, "type": "ApiConnection" }, "Compose": { "inputs": "@body('Renew_lock_on_the_session_in_a_topic_subscription')", "runAfter": { "Renew_lock_on_the_session_in_a_topic_subscription": [ "Succeeded" ] }, "type": "Compose" }, "Delay": { "inputs": { "interval": { "count": 1, "unit": "Minute" } }, "runAfter": { "Compose": [ "Succeeded" ] }, "type": "Wait" }, "Renew_lock_on_the_session_in_a_topic_subscription": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['servicebus']['connectionId']" } }, "method": "post", "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topic')))}/subscriptions/@{encodeURIComponent(parameters('sub'))}/sessions/@{encodeURIComponent(triggerBody()?['SessionId'])}/renewlock" }, "runAfter": {}, "type": "ApiConnection" }, "Renew_lock_on_the_session_in_a_topic_subscription-copy": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['servicebus']['connectionId']" } }, "method": "post", "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topic')))}/subscriptions/@{encodeURIComponent(parameters('sub'))}/sessions/@{encodeURIComponent(triggerBody()?['SessionId'])}/renewlock" }, "runAfter": { "Delay": [ "Succeeded" ] }, "type": "ApiConnection" }, "Renew_lock_on_the_session_in_a_topic_subscription-copy-copy": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['servicebus']['connectionId']" } }, "method": "post", "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topic')))}/subscriptions/@{encodeURIComponent(parameters('sub'))}/sessions/@{encodeURIComponent(triggerBody()?['SessionId'])}/renewlock" }, "runAfter": { "Renew_lock_on_the_session_in_a_topic_subscription-copy": [ "Succeeded" ] }, "type": "ApiConnection" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": { "$connections": { "defaultValue": {}, "type": "Object" }, "sub": { "defaultValue": "sub-name", "type": "String" }, "topic": { "defaultValue": "topic-na,e", "type": "String" } }, "triggers": { "When_a_message_is_received_in_a_topicsubscription(peek-lock)": { "conditions": [], "evaluatedRecurrence": { "frequency": "Second", "interval": 10 }, "inputs": { "host": { "connection": { "name": "@parameters('$connections')['servicebus']['connectionId']" } }, "method": "get", "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topic')))}/subscriptions/@{encodeURIComponent(parameters('sub'))}/messages/head/peek", "queries": { "sessionId": "Next Available", "subscriptionType": "Main" } }, "recurrence": { "frequency": "Second", "interval": 10 }, "runtimeConfiguration": { "concurrency": { "runs": 5 } }, "type": "ApiConnection" } } }, "parameters": { "$connections": { "value": { "servicebus": { "connectionId": "/subscriptions/x/resourceGroups/x/providers/Microsoft.Web/connections/servicebus", "connectionName": "servicebus", "id": "/subscriptions/x/providers/Microsoft.Web/locations/westeurope/managedApis/servicebus" } } } } }
Screenshots or Videos
When we have waiting runs:
When we don't:
Additional context
No response