Search in sources :

Example 1 with ConnectException

use of org.mule.runtime.core.api.connector.ConnectException in project mule by mulesoft.

the class AbstractSystemExceptionStrategy method handleException.

@Override
public void handleException(Exception ex, RollbackSourceCallback rollbackMethod) {
    fireNotification(ex, getCurrentEvent());
    resolveAndLogException(ex);
    logger.debug("Rolling back transaction");
    rollback(ex, rollbackMethod);
    ExceptionPayload exceptionPayload = new DefaultExceptionPayload(ex);
    if (getCurrentEvent() != null) {
        PrivilegedEvent currentEvent = getCurrentEvent();
        currentEvent = PrivilegedEvent.builder(currentEvent).message(InternalMessage.builder(currentEvent.getMessage()).exceptionPayload(exceptionPayload).build()).build();
        setCurrentEvent(currentEvent);
    }
    if (ex instanceof ConnectException) {
        ((ConnectException) ex).handleReconnection(retryScheduler);
    }
}
Also used : DefaultExceptionPayload(org.mule.runtime.core.internal.message.DefaultExceptionPayload) PrivilegedEvent(org.mule.runtime.core.privileged.event.PrivilegedEvent) DefaultExceptionPayload(org.mule.runtime.core.internal.message.DefaultExceptionPayload) ExceptionPayload(org.mule.runtime.core.api.message.ExceptionPayload) ConnectException(org.mule.runtime.core.api.connector.ConnectException)

Example 2 with ConnectException

use of org.mule.runtime.core.api.connector.ConnectException in project mule by mulesoft.

the class AbstractLifecycleManager method invokePhase.

protected void invokePhase(String phase, Object object, LifecycleCallback callback) throws LifecycleException {
    try {
        this.lastPhaseExecuted = phase;
        setExecutingPhase(phase);
        callback.onTransition(phase, object);
        setCurrentPhase(phase);
        lastPhaseExecutionFailed = false;
    }// In the case of a connection exception, trigger the reconnection strategy.
     catch (ConnectException ce) {
        lastPhaseExecutionFailed = true;
        doOnConnectException(ce);
    } catch (LifecycleException le) {
        lastPhaseExecutionFailed = true;
        throw le;
    } catch (Exception e) {
        lastPhaseExecutionFailed = true;
        throw new LifecycleException(e, object);
    } finally {
        setExecutingPhase(null);
    }
}
Also used : LifecycleException(org.mule.runtime.api.lifecycle.LifecycleException) LifecycleException(org.mule.runtime.api.lifecycle.LifecycleException) ConnectException(org.mule.runtime.core.api.connector.ConnectException) MuleException(org.mule.runtime.api.exception.MuleException) ConnectException(org.mule.runtime.core.api.connector.ConnectException)

Aggregations

ConnectException (org.mule.runtime.core.api.connector.ConnectException)2 MuleException (org.mule.runtime.api.exception.MuleException)1 LifecycleException (org.mule.runtime.api.lifecycle.LifecycleException)1 ExceptionPayload (org.mule.runtime.core.api.message.ExceptionPayload)1 DefaultExceptionPayload (org.mule.runtime.core.internal.message.DefaultExceptionPayload)1 PrivilegedEvent (org.mule.runtime.core.privileged.event.PrivilegedEvent)1