---
schema_version: "1"
id: c88e7d2fd0717e75a81e57b0f566eee20cee9e1ebf7df910b26bdad890cfc56b
title: Configuring Cross-Region Failover in Your App
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-mq-connector/latest/anypoint-mq-failover.md
canonical_url: https://docs.mulesoft.com/anypoint-mq-connector/latest/anypoint-mq-failover
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f505c07eb13860c3957e189655784241b65aea4f0c65ae772aa20299eceeec3e
description: MuleSoft Documentation Site
release: 4.x
latest: true
---
---
product: Anypoint MQ Connector
version: 4.x
is-latest-version: true
---

# Configuring Cross-Region Failover in Your App

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

Anypoint MQ Connector for Mule 4 version 4.0.7 and later provides failover capability for standard
queues.

This feature is not enabled by default. Before using this feature, review
[Configuring Cross-Region Failover for Standard Queues](https://docs.mulesoft.com/mq/mq-failover).

> [!IMPORTANT] When you enable failover for a queue and the primary region goes down, your data
> might reside in a region outside the country until the primary region is available

To use the failover feature, do the following:

- In your app:

  1.  Upgrade Anypoint MQ Connector to version 4.0.7 or later.

  2.  [Enable failover in your app.](#enable-failover-feature)

  3.  (Optional) [Change the check frequencies](#configure-check-frequency).

- In Anypoint MQ:

  1.  Create or modify a queue and
      [enable failover on the queue](https://docs.mulesoft.com/mq/mq-failover#enable-failover).

## Enable Failover in Your App

To enable the failover feature in your app, set the `cross.region.failover.feature.enabled` system
property to `true`. This property is set to `false` by default.

> [!NOTE] When the failover property is enabled, the connector handles processing messages for both
> the primary and failover queues. To prevent interruptions, the app can’t publish or consume
> directly from the fallback queue. See
> [Process Messages Directly from the Fallback Queue](#consume-directly-fallback) for information.

To set this application property in Runtime Manager:

1.  Sign in to Anypoint Platform and click **Runtime Manager** in the navigation menu.

2.  Deploy a new app or change the settings for a deployed app.

3.  On the **Properties** tab, specify the value for the property, for example:

    ![Properties table with cross.region.failover.feature.enabled set to true](/mulesoft/current/en-us/anypoint-mq-connector/latest/_images/mq-set-properties-failover-enabled.png)

Alternatively, set the property in **Run Configurations** in Anypoint Studio. For more information,
see [System Properties in Mule Apps](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system).

## Process Messages Directly from the Fallback Queue

If failover is enabled for an app, Anypoint MQ Connector manages the fallback queue (with the `_fb`
suffix) and prevents publish, consume, or subscribe operations on the fallback queue directly. If
the app connects to the fallback queue directly, Anypoint MQ Connector returns an error:

```none
java.lang.IllegalArgumentException: Using fallback queue directly is not supported
```

If you disable failover on a queue (from the Anypoint MQ UI) and restart the application, the
connector no longer publishes or consumes from the fallback queue.

To process any messages that remain in the fallback queue after disabling failover:

1.  Configure the app to process directly from the fallback queue.

    For the Consume or Subscriber operations, set the **Queue** field to the name of the fallback
    queue, for example:

    ![Subscriber configuration with the queue name, myDemoQueue\_fb](/mulesoft/current/en-us/anypoint-mq-connector/latest/_images/mq-publish-fallback-queue-subscribe.png)

2.  Allow the app to consume messages directly from the fallback queue:

    1.  Sign in to Anypoint Platform and click **Runtime Manager** in the navigation menu.

    2.  Change the settings for a deployed app.

    3.  On the **Properties** tab, set the `cross.region.failover.feature.enabled` system property
        to `false`, for example:

        ![Properties table with cross.region.failover.feature.enabled set to false](/mulesoft/current/en-us/anypoint-mq-connector/latest/_images/mq-set-properties-failover-disabled.png)

        Alternatively, set the property in **Run Configurations** in Anypoint Studio. For more
        information, see
        [System Properties in Mule Apps](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system).

## Configure the Frequency of Fallback Queue Checks

By default, when the primary region is down, Anypoint MQ Connector checks the:

- Fallback queue once every five minutes for new messages (300,000 milliseconds)

- Primary queue to see if the primary region is back up once per minute (60,000 milliseconds)

To change this behavior, set the following properties:

<table><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Description</th><th>Minimum Value</th><th>Maximum Value</th><th>Default Value</th></tr></thead><tbody><tr><td colspan="5"><p><code>primary.region.status.check.interval.ms</code></p></td></tr><tr><td></td><td><p>How often the connector checks the availability of the primary region when processing from the fallback region</p></td><td><p>1 minute (60,000 milliseconds)</p></td><td><p>15 minutes (900,000 milliseconds)</p></td><td><p>1 minute (60,000 milliseconds)</p></td></tr><tr><td colspan="5"><p><code>fallback.messages.check.interval.ms</code></p></td></tr><tr><td></td><td><p>How often the connector checks the fallback queue for received messages</p></td><td><p>1 minute (60,000 milliseconds)</p></td><td><p>12 hours (43.2 million milliseconds)</p></td><td><p>5 minutes (300,000 milliseconds)</p></td></tr></tbody></table>

To set these application properties in Runtime Manager:

1.  Sign in to Anypoint Platform and click **Runtime Manager** in the navigation menu.

2.  Deploy a new app or change the settings for a deployed app.

3.  On the **Properties** tab, specify values for the following properties (in milliseconds):

    ![Properties table with intervals for primary and fallback status check intervals](/mulesoft/current/en-us/anypoint-mq-connector/latest/_images/mq-set-properties-failover.png)

Alternatively, set these properties in **Run Configurations** in Anypoint Studio. For more
information, see
[System Properties in Mule Apps](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-system)

### Check Interval Considerations

To determine how to set the application property values to fine-tune the check intervals:

- When publishing to the fallback region during primary region downtime, the Publish operation of
  Anypoint MQ Connector checks if the primary region is back up once per minute by default.

  If a flow triggers the Publish operation less frequently than once per minute, the connector
  checks to see if the primary region is back up every time the operation is triggered.

  To fine-tune this behavior, set the value of `primary.region.status.check.interval.ms` to be
  greater than the frequency at which your flow triggers the Publish operation.

- When a flow triggers the Consumer or Subscriber operation of Anypoint MQ Connector, the connector
  checks the fallback queue (every five minutes by default) for new messages before checking the
  primary queue.

  If a flow triggers the Consumer or Subscriber operation less frequently than every five minutes,
  the connector first checks the fallback queue for new messages before consuming from the primary
  queue.

  To reduce the frequency of checking the fallback queue, set the value of
  `fallback.messages.check.interval.ms` to be greater than the frequency at which your flow triggers
  the Consumer or Subscriber operation.

  > [!NOTE] Setting this property to a high value might result in out-of-order messages because
  > messages in the fallback queue are not processed as frequently.

## See Also

- [Configuring Cross-Region Failover for Standard Queues](https://docs.mulesoft.com/mq/mq-failover)

- [Changing App Behavior with Properties on CloudHub 2.0](https://docs.mulesoft.com/cloudhub-2/ch2-manage-props)

- [Manage Properties for Applications on CloudHub](https://docs.mulesoft.com/cloudhub/cloudhub-manage-props)

- [Anypoint MQ Connector in Anypoint Exchange](https://anypoint.mulesoft.com/exchange/com.mulesoft.connectors/anypoint-mq-connector/)

- [Anypoint MQ Connector Release Notes for Mule 4](https://docs.mulesoft.com/release-notes/connector/anypoint-mq-connector-release-notes-mule-4)
