Class ConnectivityErrors

java.lang.Object
com.mulesoft.extension.mq.internal.ConnectivityErrors

public final class ConnectivityErrors extends Object
Single source of truth for "did this failure mean we lost the broker connection?".

The MQ subscriber must ask the runtime to reconnect only on genuine connectivity loss, never on an application-level failure (a bad message, a lock error, an IllegalStateException). Matching is deliberately by specific connection-failure types rather than the broad IOException umbrella, because IOException also covers non-connectivity faults (a truncated response body, an EOF while parsing) that must not trigger a reconnect.

The May 7 us-east-1 incident (W-22472649) surfaced as java.net.ConnectException: Connect timeout on the ack (DELETE) path. The rest-client only normalises a narrow set of failures to MQClientConnectionException (see AbstractCourierRestClient: a TimeoutException, a ConnectException whose message contains "Connection refused", or an IOException whose message contains "Remotely closed"); any other transport failure reaches the observer's onError as the raw exception. So keying reconnection solely off MQClientConnectionException misses the very error that stranded the consumer. ConnectException extends SocketException, so matching SocketException covers connect-timeout, connection-reset and no-route failures in one entry.

Matching is on the reported throwable itself, not its cause chain: every connectivity error we have evidence for on this path (the incident's ConnectException, the rest-client's own MQClientConnectionException) arrives at onError unwrapped. A cause-chain walk would only add false positives — an unrelated application error that happens to bury a socket exception deep in its cause chain would wrongly trigger a reconnect. If a future rest-client version starts wrapping connectivity failures, add the wrapping case then, with a concrete example in hand.

  • Method Details

    • isConnectionFailure

      public static boolean isConnectionFailure(Throwable throwable)
      Parameters:
      throwable - the failure reported to an ack/nack/fetch onError
      Returns:
      true if throwable is a connection failure that warrants signalling the runtime to reconnect