/** * Remove any test queues that were created by an * {@link #isRunningWithEmptyQueues(String...)} method. * @param additionalQueues additional queues to remove that might have been created by * tests. */ public void removeTestQueues(String... additionalQueues) { List<String> queuesToRemove = Arrays.asList(this.queues); if (additionalQueues != null) { queuesToRemove = new ArrayList<>(queuesToRemove); queuesToRemove.addAll(Arrays.asList(additionalQueues)); } logger.debug("deleting test queues: " + queuesToRemove); Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = getConnection(getConnectionFactory()); connection.setId(generateId() + ".queueDelete"); channel = connection.createChannel(); for (String queue : queuesToRemove) { channel.queueDelete(queue); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }
/** * Delete arbitrary queues from the broker. * @param queues the queues to delete. */ public void deleteQueues(String... queues) { Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = getConnection(getConnectionFactory()); connection.setId(generateId() + ".queueDelete"); channel = connection.createChannel(); for (String queue : queues) { channel.queueDelete(queue); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }
/** * Remove any test queues that were created by an * {@link #isRunningWithEmptyQueues(String...)} method. * @param additionalQueues additional queues to remove that might have been created by * tests. */ public void removeTestQueues(String... additionalQueues) { List<String> queuesToRemove = Arrays.asList(this.queues); if (additionalQueues != null) { queuesToRemove = new ArrayList<>(queuesToRemove); queuesToRemove.addAll(Arrays.asList(additionalQueues)); } logger.debug("deleting test queues: " + queuesToRemove); Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = getConnection(getConnectionFactory()); connection.setId(generateId() + ".queueDelete"); channel = connection.createChannel(); for (String queue : queuesToRemove) { channel.queueDelete(queue); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }
/** * Delete arbitrary exchanges from the broker. * @param exchanges the exchanges to delete. */ public void deleteExchanges(String... exchanges) { Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = getConnection(getConnectionFactory()); 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); } }
/** * Delete arbitrary exchanges from the broker. * @param exchanges the exchanges to delete. */ public void deleteExchanges(String... exchanges) { Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = getConnection(getConnectionFactory()); 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); } }
/** * Delete arbitrary queues from the broker. * @param queues the queues to delete. */ public void deleteQueues(String... queues) { Connection connection = null; // NOSONAR (closeResources()) Channel channel = null; try { connection = getConnection(getConnectionFactory()); connection.setId(generateId() + ".queueDelete"); channel = connection.createChannel(); for (String queue : queues) { channel.queueDelete(queue); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }
connection = getConnection(getConnectionFactory()); channel = createQueues(connection);
connection = getConnection(getConnectionFactory()); channel = createQueues(connection);