List of usage examples for com.rabbitmq.client Connection close
@Override void close() throws IOException;
From source file:workqueue.NewTask.java
public static void main(String[] argv) throws Exception { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("datdb.cphbusiness.dk"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare(TASK_QUEUE_NAME, true, false, false, null); String message = getMessage(argv); channel.basicPublish("", TASK_QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes("UTF-8")); System.out.println(" [x] Sent '" + message + "'"); channel.close();/*w w w. ja va 2s . c om*/ connection.close(); }
From source file:wunderrabbit.RabbitMessaging.java
License:Apache License
@Override public void stop() throws Exception { if (this.started) { this.connectionFactory = null; for (Connection each : connections) { each.close(); }//from w ww. j av a2s. co m this.connections.clear(); this.started = false; } }
From source file:zipkin2.reporter.amqp.RabbitMQSender.java
License:Apache License
@Override public synchronized void close() throws IOException { if (closeCalled) return;//from w w w.jav a 2 s. c o m Connection connection = this.connection; if (connection != null) connection.close(); closeCalled = true; }