private static boolean isRetryable(ShutdownSignalException e) { if (e.isInitiatedByApplication()) return false; Method method = e.getReason(); if (method instanceof AMQP.Connection.Close) return isRetryable(((AMQP.Connection.Close) method).getReplyCode()); if (method instanceof AMQP.Channel.Close) return isRetryable(((AMQP.Channel.Close) method).getReplyCode()); return false; }
protected void callShutdownListener(RetryableResource resource, ShutdownSignalException e) { Method method = e.getReason(); if (method instanceof AMQP.Connection.Close) { if (recoveryChannel != null) when(recoveryChannel.isOpen()).thenReturn(false); connectionHandler.shutdownListeners.get(0).shutdownCompleted(e); } else if (method instanceof AMQP.Channel.Close) resource.shutdownListeners.get(0).shutdownCompleted(e); }
@Override public void asyncRpc(Method method) throws IOException { channel.asyncRpc(method); }
@Override public Command rpc(Method method) throws IOException { return channel.rpc(method); }
@Override public CompletableFuture<Command> asyncCompletableRpc( Method method) throws IOException { return channel.asyncCompletableRpc(method); }
protected ShutdownSignalException nonRetryableChannelShutdownSignal() { Method m = new AMQP.Channel.Close.Builder().replyCode(404).build(); return new ShutdownSignalException(false, false, m, null); }
protected ShutdownSignalException retryableChannelShutdownSignal() { Method m = new AMQP.Channel.Close.Builder().replyCode(311).build(); return new ShutdownSignalException(false, false, m, null); }
protected ShutdownSignalException retryableConnectionShutdownSignal() { Method m = new AMQP.Connection.Close.Builder().replyCode(320).build(); return new ShutdownSignalException(true, false, m, null); }
protected ShutdownSignalException nonRetryableConnectionShutdownSignal() { Method m = new AMQP.Connection.Close.Builder().replyCode(530).build(); return new ShutdownSignalException(true, false, m, null); }
/** * Asynchronously send a method over this channel. * @param method method to transmit over this channel. * @throws IOException Problem transmitting method. */ void asyncRpc(Method method) throws IOException;
/** * Synchronously send a method over this channel. * @param method method to transmit over this channel. * @return command response to method. Caller should cast as appropriate. * @throws IOException Problem transmitting method. */ Command rpc(Method method) throws IOException;