---
schema_version: "1"
id: 3284ae5f47ac32e595e7fd84f904f5dffa2eff1888b390ab664c39965bc661f5
title: Configure a Redelivery Policy
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/latest/redelivery-policy.md
canonical_url: https://docs.mulesoft.com/mule-runtime/latest/redelivery-policy
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0d4effa3673c2acc01884d14e618f0a6b806a28ba2c8509c5fe97f4d8f282e95
description: MuleSoft Documentation Site
release: "4.13"
latest: true
---
---
product: Mule Runtime
version: 4.13
is-latest-version: true
keywords: anypoint studio, flow, redelivery, policy
---

# Configure a Redelivery Policy

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

A redelivery policy is a filter that helps you conserve resources by limiting the number of times
the Mule runtime engine (Mule) executes messages that generate errors. You can add a redelivery
policy to any source in a flow.

When you add a redelivery policy to a flow’s source, Mule evaluates the received data before it
executes the flow’s components. If a message delivery fails a specified number of times, the
redelivery policy prevents the flow from processing the received data and raises a
REDELIVERY\_EXHAUSTED error.

## Redelivery Policy Configuration Parameters

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Field</th><th>Type</th><th>Default Value</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><strong>Max Redelivery Count</strong></p></div></div></td><td><div><div><p>Number</p></div></div></td><td><div><div><p>5</p></div></div></td><td><div><div><p>Maximum number of times that a message can be redelivered to the flow and processed unsuccessfully before raising a MULE:REDELIVERY_EXHAUSTED error.</p></div></div></td></tr><tr><td><div><div><p><strong>Use Secure Hash</strong></p></div></div></td><td><div><div><p>Boolean</p></div></div></td><td><div><div><p>True</p></div></div></td><td><div><div><p>Indicates whether to use a secure hash algorithm to identify a redelivered message.</p></div></div></td></tr><tr><td><div><div><p><strong>Message Digest Algorithm</strong></p></div></div></td><td><div><div><p>String</p></div></div></td><td><div><div><p>SHA-256</p></div></div></td><td><div><div><p>Secure hashing algorithm to use for the message. If the payload of the message is a Java object, Mule ignores the <strong>Message Digest Algorithm</strong> value and returns the value that the payload’s <code>hashCode()</code> returned.</p></div></div></td></tr><tr><td><div><div><p><strong>ID Expression</strong></p></div></div></td><td><div><div><p>Expression</p></div></div></td><td><div><div><p>-</p></div></div></td><td><div><div><p>Defines one or more expressions that determine when a message has been redelivered. This property can be set only if the value of <strong>Use Secure Hash</strong> is False.</p></div></div></td></tr><tr><td><div><div><p><strong>Object Store</strong></p></div></div></td><td><div><div><p>String</p></div></div></td><td><div><div><p>Object Store created by Mule’s default <code>ObjectStoreManager</code>. Nonpersistent, with an <code>entryTtl</code> of 300 seconds and an <code>expirationInterval</code> of 6 seconds.</p></div></div></td><td><div><div><p>Object Store in which the redelivery counter for each message is stored. You can configure the Object Store as a reference or an inner element.</p></div><div><p>For information, see the <a href="https://docs.mulesoft.com/object-store-connector/latest/">Object Store connector documentation</a>.</p></div></div></td></tr></tbody></table>

## How the Redelivery Policy Works

Each time the source receives a new message, Mule identifies the message by generating its key.

- If the processing flow causes an exception, Mule increments the counter associated with the
  message key. When the counter reaches a value greater than the configured **maxRedeliveryCount**
  value, Mule throws a MULE:REDELIVERY\_EXHAUSTED error.

- If the processing flow does not cause an exception, its counter is reset.

## Errors

- MULE:REDELIVERY\_EXHAUSTED

  Thrown when the number of executions that raise an error is greater than the configured
  **maxRedeliveryCount** value.

## Example

In this example, Mule logs an error with a `Redelivery exhausted in http listener` message when the
**maxRedeliveryCount** of 2 is exceeded:

```xml
<flow name="logOnRedeliveryExhausted">
    <http:listener path="test" config-ref="listenerConfig">
        <redelivery-policy maxRedeliveryCount="2" useSecureHash="true"/>
    </http:listener>
    <flow-ref name="processData"/>
    <error-handler>
        <on-error-continue type="MULE:REDELIVERY_EXHAUSTED">
            <logger message="Redelivery exhausted in http listener" level="ERROR"/>
        </on-error-continue>
    </error-handler>
</flow>
```

## See Also

- [Mule Overview](https://docs.mulesoft.com/mule-runtime/latest/)

- [Flow and Subflow Scopes](https://docs.mulesoft.com/mule-runtime/latest/flow-component)
