public void stop() throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (TimeoutException e) { LOG.error("Timeout when closing AMQP channel", e); channel.abort(); } } if (connection != null && connection.isOpen()) { connection.close(); } }
void destruct() throws IOException { for (Channel chan : pool) { try { chan.close(); } catch (IOException e) { chan.abort(); } } } }
@Override public void abort(int closeCode, String closeMessage) throws IOException { this.delegate.abort(closeCode, closeMessage); }
@Override public void abort(int closeCode, String closeMessage) throws IOException { this.delegate.abort(closeCode, closeMessage); }
@Override public void abort() throws IOException { this.delegate.abort(); }
@Override public void abort() throws IOException { this.delegate.abort(); }
public void stop() throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (TimeoutException e) { LOG.error("Timeout when closing AMQP channel", e); channel.abort(); } } if (connection != null && connection.isOpen()) { connection.close(); } }
@Override public void onMessage(Message message, Channel channel) throws Exception { String value = new String(message.getBody()); logger.debug("Receiving: " + value); if (failed.compareAndSet(false, true)) { // intentional error (causes exception on connection thread): channel.abort(); } else { latch.countDown(); } } }
public void stop() throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (TimeoutException e) { LOG.error("Timeout when closing AMQP channel", e); channel.abort(); } } if (connection != null && connection.isOpen()) { connection.close(); } }
public void close() throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (TimeoutException e) { LOG.error("Timeout when closing AMQP channel", e); channel.abort(); } } if (connection != null && connection.isOpen()) { connection.close(); } }
protected void connect() throws IOException, ShutdownSignalException { log.debug( "Connecting to rabbitMQ broker: " + connectionProvider.getFactory().getHost() + ":" + connectionProvider.getFactory().getPort() ); if( channel != null ) { channel.abort(); } if( connection == null ) { connection = connectionProvider.getFactory().newConnection(); } channel = connection.createChannel(); consumer = replaceConsumer( channel ); channel.basicRecover( true ); channel.queueDeclare( getQueue(), AMQP_DURABLE, AMQP_EXCLUSIVE, AMQP_AUTO_DELETE, new HashMap<String, Object>() ); channel.basicConsume( getQueue(), AMQP_AUTO_ACK, consumer.getConsumer() ); }