List of usage examples for com.rabbitmq.client Channel exchangeBind
Exchange.BindOk exchangeBind(String destination, String source, String routingKey) throws IOException;
From source file:pl.nask.hsn2.bus.rabbitmq.RbtUtils.java
License:Open Source License
/** * Creates exchanges and static bindings between them. * //from w ww . j av a 2s . c o m * @param connection Connection to Rabbit MQ server. * @param exchangeCommonName Common exchange name. * @param exchangeServicesName Services exchange name. * @param exchangeMonitoringName Monitoring exchange name. * @throws BusException Any problem with connection or queue will thrown an exception. */ public static void createExchanges(Connection connection, String exchangeCommonName, String exchangeServicesName, String exchangeMonitoringName) throws BusException { Channel channel = createChannel(connection); try { channel.exchangeDeclare(exchangeCommonName, "fanout"); channel.exchangeDeclare(exchangeMonitoringName, "fanout"); channel.exchangeDeclare(exchangeServicesName, "direct"); channel.exchangeBind(exchangeMonitoringName, exchangeCommonName, ""); channel.exchangeBind(exchangeServicesName, exchangeCommonName, ""); } catch (IOException ex) { throw new BusException(ex); } finally { closeChannel(channel); } }