Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Reconnection Strategy Reference

This section describes the reconnection strategies you can configure by editing your Mule application’s XML configuration file.

Reconnect

A reconnection strategy that allows the user to configure how many times a reconnection should be attempted and how long to wait between attempts.

Attributes of reconnect

Name Type Required Default Description

blocking

boolean

no

true

If false, the reconnection strategy runs in a separate, non-blocking thread

frequency

long

no

2000

How often (in ms) to reconnect

count

integer

no

2

How many reconnection attempts to make

Child Elements of reconnect

Name Cardinality Description

abstract-reconnect-notifier

0..1

A placeholder for a reconnection notifier element. The RetryNotifier interface is a callback that allows actions to be performed after each reconnection attempt, for example, firing server notification events on success or failure.

For example:


          
       
1
2
3
<jms:activemq-connector name="AMQConnector">
    <reconnect count="5" frequency="1000"/>
</jms:activemq-connector>

Reconnect Forever

A reconnection strategy that retries an infinite number of times at the specified frequency.

Attributes of reconnect-forever

Name Type Required Default Description

blocking

boolean

no

true

If false, the reconnection strategy runs in a separate, non-blocking thread.

frequency

long

no

2000

How often (in ms) to reconnect.

Reconnect Custom Strategy

A user-defined reconnection strategy.

Attributes of <reconnect-custom-strategy…​>

Name Type Required Default Description

blocking

boolean

no

true

If false, the reconnection strategy runs in a separate, non-blocking thread.

class

A class that implements the RetryPolicyTemplate interface.

Child Elements of reconnect-custom-strategy

Name Cardinality Description

abstract-reconnect-notifier

0..1

A placeholder for a reconnection notifier element. The RetryNotifier interface is a callback that allows actions to be performed after each reconnection attempt, for example, firing server notification events on success or failure.

spring:property

0..*

For example:


          
       
1
2
3
4
5
6
<jms:activemq-connector name="AMQConnector">
    <reconnect-custom-strategy class="org.mule.retry.test.TestRetryPolicyTemplate">
        <spring:property name="fooBar" value="true"/>
        <spring:property name="revolutions" value="500"/>
    </reconnect-custom-strategy>
</jms:activemq-connector>

Reconnect Notifier

A reconnect notifier is called for each reconnection attempt and is also configurable. You can create a custom reconnect notifier that implements the org.mule.api.retry.RetryNotifier interface.

The Reconnector notifier element fires a ConnectionNotification upon each reconnection attempt. There are no attributes or child elements for the notifier element.

For example:


         
      
1
2
3
4
5
<jms:activemq-connector name="AMQConnector">
    <reconnect>
        <reconnect-notifier/>
    </reconnect>
</jms:activemq-connector>

Reconnect Custom Notifier

A user-defined reconnection notifier.

Attributes of reconnect-custom-notifier

Name Type Required Description

class

class name

yes

A class that implements the RetryNotifier interface. There’s no default value.

Child Elements of reconnect-custom-notifier

Name Cardinality

spring:property

0..*

For example:


          
       
1
2
3
4
5
6
7
<jms:activemq-connector name="AMQConnector">
    <reconnect>
        <reconnect-custom-notifier class="org.mule.retry.test.TestRetryNotifier">
            <spring:property name="color" value="red"/>
        </reconnect-custom-notifier>
    </reconnect>
</jms:activemq-connector>