geoffc
geoffc

Reputation: 153

Mule DevKit Connectors, Connection Management and reconnect policies

Should a custom Mule connector written using the DevKit be compatible by default with reconnection policies. e.g., I wrote a connector using connection management following http://www.mulesoft.org/documentation/display/current/Implementing+Connection+Management

When I set up an error condition and my @Connect method throws a ConnectionException my flow stops and the connector doesn't try to reconnect despite having a global config element:

<configuration>
    <reconnect-forever frequency="2000"/>
</configuration>

I know this config is working because it has the expected effect on a JDBC transport but not on my custom connector.

Am I missing something fundamental? Should custom connectors work at all with reconnect-forever policies?

I'm using Mule 3.4 CE and DevKit 3.4

Thanks for any help or pointers in the right direction.

Upvotes: 2

Views: 635

Answers (1)

Pablo Cabrera
Pablo Cabrera

Reputation: 116

In DevKit, in order for your operations to trigger the reconnection mechanism you need to mark the processor with the @ReconnectOn annotation, and specify the exception that will trigger the reconnection.

@Processor
@ReconnectOn(exceptions = {TypeAException.class, TypeBException.class})
public boolean fooProcessor(String param) 
                         throws TypeAException, TypeBException, TypeCException;

In this example the exception of TypeCException will not trigger the reconnection, the others will.

If your @ValidateConnection method returns true, the @Connect won't be called again.

Upvotes: 3

Related Questions