List of usage examples for com.rabbitmq.client Channel exchangeDelete
Exchange.DeleteOk exchangeDelete(String exchange) throws IOException;
From source file:genqa.ExportRabbitMQVerifier.java
License:Open Source License
private static void tearDown(Channel channel) throws IOException { channel.exchangeDelete("testExchange"); }
From source file:it.txt.ens.authorisationService.amqp.AMQPExchangeHelper.java
License:Apache License
/** * Deletes an exchange//from w ww . jav a 2 s. co m * @throws IOException */ public void delete(Channel channel, String exchange) throws IOException { channel.exchangeDelete(exchange); }
From source file:net.roboconf.messaging.internal.client.MessageServerClientRabbitMq.java
License:Apache License
@Override public void cleanAllMessagingServerArtifacts() throws IOException { if (this.connected) throw new IOException("This instance is already connected to the messaging server."); ConnectionFactory factory = new ConnectionFactory(); factory.setHost(this.messageServerIp); Connection connection = factory.newConnection(); Channel channel = this.connection.createChannel(); channel.exchangeDelete(getExchangeName(true)); channel.exchangeDelete(getExchangeName(false)); channel.close();//from w w w . j a v a 2 s .c o m connection.close(); }
From source file:org.ballerinalang.messaging.rabbitmq.util.ChannelUtils.java
License:Open Source License
/** * Deletes an exchange./*from w w w.jav a 2 s. c o m*/ * * @param channel RabbitMQ Channel object. * @param exchangeName Name of the exchange. */ public static void exchangeDelete(Channel channel, String exchangeName) { try { channel.exchangeDelete(exchangeName); } catch (Exception e) { String errorMessage = "An error occurred while deleting the exchange "; throw new BallerinaException(errorMessage + e.getMessage(), e); } }
From source file:org.mule.transport.amqp.harness.rules.AmqpModelCleanupRule.java
License:Open Source License
protected void cleanExchanges(String[] exchanges, Channel channel) throws IOException { for (String exchange : exchanges) { channel.exchangeDelete(exchange); }//w ww . j a va2 s . com }
From source file:org.mule.transport.amqp.harness.rules.AmqpModelRule.java
License:Open Source License
protected void undoExchangesConfiguration(Configuration configuration, Channel channel) throws IOException { List<Exchange> configurationExchanges = configuration.getExchanges(); for (Exchange exchange : configurationExchanges) { channel.exchangeDelete(exchange.getName()); }//from w w w. j av a 2 s . c o m }
From source file:org.springframework.amqp.rabbit.core.RabbitAdmin.java
License:Apache License
@Override @ManagedOperation/* ww w .j a va 2 s . c o m*/ public boolean deleteExchange(final String exchangeName) { return this.rabbitTemplate.execute(new ChannelCallback<Boolean>() { @Override public Boolean doInRabbit(Channel channel) throws Exception { if (isDeletingDefaultExchange(exchangeName)) { return true; } try { channel.exchangeDelete(exchangeName); } catch (IOException e) { return false; } return true; } }); }
From source file:org.springframework.amqp.rabbit.junit.BrokerRunning.java
License:Apache License
/** * Delete arbitrary exchanges from the broker. * @param exchanges the exchanges to delete. */// w ww .ja v a2 s.c o m public void deleteExchanges(String... exchanges) { ConnectionFactory connectionFactory = getConnectionFactory(); Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = connectionFactory.newConnection(); connection.setId(generateId() + ".exchangeDelete"); channel = connection.createChannel(); for (String exchange : exchanges) { channel.exchangeDelete(exchange); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }
From source file:org.teksme.server.common.messaging.AMQPBrokerManager.java
License:Apache License
protected void deleteExchange(Channel channel, String exchange) throws IOException { channel.exchangeDelete(exchange); }
From source file:reactor.rabbitmq.RabbitFluxTests.java
License:Open Source License
@Test public void createResourcesPublishConsume() throws Exception { final String queueName = UUID.randomUUID().toString(); final String exchangeName = UUID.randomUUID().toString(); final String routingKey = "a.b"; int nbMessages = 100; try {/*from w ww. java2 s . co m*/ sender = createSender(); receiver = RabbitFlux.createReceiver(); CountDownLatch latch = new CountDownLatch(nbMessages); AtomicInteger count = new AtomicInteger(); Disposable resourceSendingConsuming = sender.declare(exchange(exchangeName)) .then(sender.declare(queue(queueName))) .then(sender.bind(binding(exchangeName, routingKey, queueName))) .thenMany(sender.send(Flux.range(0, nbMessages) .map(i -> new OutboundMessage(exchangeName, routingKey, i.toString().getBytes())))) .thenMany(receiver.consumeNoAck(queueName, new ConsumeOptions().stopConsumingBiFunction( (emitter, msg) -> Integer.parseInt(new String(msg.getBody())) == nbMessages - 1))) .subscribe(msg -> { count.incrementAndGet(); latch.countDown(); }); assertTrue(latch.await(5, TimeUnit.SECONDS)); assertEquals(nbMessages, count.get()); resourceSendingConsuming.dispose(); } finally { final Channel channel = connection.createChannel(); channel.exchangeDelete(exchangeName); channel.queueDelete(queueName); channel.close(); } }