You are processing messages from an Anypoint MQ queue, but your Mule application fails with an ACK or NACK requests. This issue can be observed when the MQ flow is configurd with maxConcurrency (i.e maxConcurrency=1) limiting the cucurrent events from the flow level.
This situation commonly arises in the following scenarios:
The error log contains a 400 Bad Request message with the following details:
com.mulesoft.mq.restclient.exception.RestException: An error occurred while executing the operation: ACK ONE MESSAGE. Cause: 400 - Bad Request ({
"status" : "failure",
"statusMessage" : "LockId: AQEBpeUWnHhPYVU....Im8Q20oe0J provided is expired"
}).
This error occurs when the lockID TTL is expired. The default Acknowledgement timeout for an Anyoint MQ subscriber is 2 mintues if not explicitly configured.
Detailed Message Flow Analysis (FIFO with maxConcurrency and long processing duration)
| 1 | 10 messages received by subscriber |
DEBUG 2025-11-04 10:49:34,597 Received messages count: 10 |
| 2 | First message received and lockID received |
DEBUG 2025-11-04 10:49:34,597 Message received with ID: 3f3bab4a-6642-487b-8b9f-4e36b6fcea8a and lock ID: AQEBLAG7BA0AH9y5yIQZTJyMLWL0HyarBc829WiH3ZYBucZmNs+...... |
| 3 | First message dispatched for processing |
DEBUG 2025-11-04 10:49:34,644 Message dispatched with ID: 3f3bab4a-6642-487b-8b9f-4e36b6fcea8a |
| 4 | Second message received but queued (not yet dispatched) |
DEBUG 2025-11-04 10:49:34,645 Message received with ID: 767ed392-b4f7-47d9-9a75-d0704ccf7ead and lock ID: AQEBpeUWnHhPYVUoFV5gBNMkwluz0Jl.... |
| 5 | First message processed and ACKed successfully |
DEBUG 2025-11-04 10:51:05,109 Received response from DELETE https://mq-ap-southeast-2.anypoint.mulesoft.com/api/v1/organizations/<orgID>/environments/<envID>/destinations/testing-fifo/messages/3f3bab4a-6642-487b-8b9f-4e36b6fcea8a. Request Id: c11befff-9ea0-433c-b798-7b8b2871119e. Response code: 200 |
| 6 | Second message dispatched |
DEBUG 2025-11-04 10:51:05,114 Message dispatched with ID: 767ed392-b4f7-47d9-9a75-d0704ccf7ead |
| 7 | Third message received but queued (not yet dispatched) |
DEBUG 2025-11-04 10:51:05,115 Message received with ID: d7fb2169-969f-4299-9c10-7dffd3b34561 and lock ID: AQEBrPzw4FFcvJ3wrcX…. |
| 8 | ACK triggered against the second message |
DEBUG 2025-11-04 10:52:35,164 Sending DELETE request to https://mq-ap-southeast-2.anypoint.mulesoft.com/api/v1/organizations/<orgID>/environments/<envID>/destinations/testing-fifo/messages/767ed392-b4f7-47d9-9a75-d0704ccf7ead DEBUG 2025-11-04 10:52:35,316 Received response from DELETE https://mq-ap-southeast-2.anypoint.mulesoft.com/api/v1/organizations/<orgID>/environments/<envID>/destinations/testing-fifo/messages/767ed392-b4f7-47d9-9a75-d0704ccf7ead. Request Id: 8cd9ebcf-9cf0-4076-8be1-d018245df935. Response code: 400 NOTE: By this time, the lock on the second message has expired — the default lock duration in Anypoint MQ is typically 120 seconds (2 minutes). |
| 9 | NACK triggered by error handler |
DEBUG 2025-11-04 10:52:35,354 Sending DELETE request to https://mq-ap-southeast-2.anypoint.mulesoft.com/api/v1/organizations/<orgID>/environments/<envID>/destinations/testing-fifo/messages/767ed392-b4f7-47d9-9a75-d0704ccf7ead/locks/ AQEBpeUWnHhPYVUoFV5gBNMkwluz....2Fd8i9gStIm8Q20oe0J DEBUG 2025-11-04 10:52:35,450 |
1.Increase TTL for the acknowledgementTimeout in the subscriber configuration. The default TTL is two minutes.
For example:
<anypoint-mq:subscriber doc:name="Subscriber" doc:id="5100fdd2-752b-49bf-9d12-53409da59b4e" destination="testing-fifo" acknowledgementMode="MANUAL" config-ref="Anypoint_MQ_Config" acknowledgementTimeout="5" acknowledgementTimeoutUnit="MINUTES">
<anypoint-mq:subscriber-type >
<anypoint-mq:polling>
<scheduling-strategy >
<fixed-frequency />
</scheduling-strategy>
</anypoint-mq:polling>
</anypoint-mq:subscriber-type>
</anypoint-mq:subscriber>
2. Reduce the polling size.
If the average or worst-case message processing time is relatively long, maintaining a polling size of 10 increases the likelihood of encountering lock ID expiration errors. This is because, with maxConcurrency=1, all 10 messages are fetched at once but processed sequentially — one message at a time due to the limitation set on the flow level.
By the time the first few messages are fully processed and an ACK is sent, the lock TTL for later messages may have already expired. This leads to the HTTP 400 – “LockId provided is expired” error when the ACK is attempted.
To prevent this, consider reducing the polling size (i.e 1 or 2) so that fewer messages are fetched per poll, aligning the total processing time with the lock duration.
Note:
This behavior is not a bug in the Anypoint MQ connector.
Messages are processed sequentially because maxConcurrency=1 is explicitly configured at the flow level, which limits parallel message handling.
3. Optimize or parallelize long-running operations where possible
4. Consider Queue Type & Concurrency Requirements
If parallel message processing is required, consider using a Standard queue with an increased maxConcurrency value.
While a FIFO queue technically allows maxConcurrency > 1 (for example, maxConcurrency=10), doing so means messages may not be processed in strict order. Since message ordering is the core feature of FIFO, maintaining maxConcurrency=1 is required to preserve guaranteed ordering. For more info, please refer to a KB Anypoint MQ FIFO Queue Message is not in order if maxConcurrency is not 1
005228013

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.