src/main/java/io/paradoxical/rabbitmq/queues/QueuePublisher.java
/**
     * Prevent excess over the wire calls to RMQ by caching if we've already declared an exchange
     */
Prevent excess over the wire calls to RMQ by caching if we've already declared an exchange
Prevent excess over the wire calls to RMQ by caching if we ' ve already declared an exchange
private void declareExchange(final Exchange exchange) throws IOException {
        String exchangeName = exchange.getExchangeName();
        if (!cachedDeclaredExchangeNames.containsKey(exchangeName)) {
            try {
                ExchangeUtils.declare(getChannel(), exchange);
            }
            catch (IOException ex) {
                logger.warn(ex, "Error re-declaring exchange");
                createChannel();
            }
            cachedDeclaredExchangeNames.put(exchangeName, true);
        }
    }
private void declareExchange ( final Exchange exchange ) throws IOException { String exchangeName = exchange . getExchangeName ( ) ; if ( ! cachedDeclaredExchangeNames . containsKey ( exchangeName ) ) { try { ExchangeUtils . declare ( getChannel ( ) , exchange ) ; } catch ( IOException ex ) { logger . warn ( ex , "Error re-declaring exchange" ) ; createChannel ( ) ; } cachedDeclaredExchangeNames . put ( exchangeName , true ) ; } }
Prevent excess over the wire calls to RMQ by caching if we've already declared an exchange
Prevent excess over the wire calls to RMQ by caching if we ' ve already declared an exchange
// failed to create exchange due maybe to configuration issues, try and ignore // this causes the underlying channel to close, so we should make sure to reopen it // if thats the case the exchange already exists, so it doesn't matter if we failed to declare it