ConsumerChannelRegistry.registerConsumerChannel(this.consumer.getChannel(), getConnectionFactory());
new RabbitResourceHolder(consumer.getChannel(), false), getConnectionFactory(), true);
ConsumerChannelRegistry.registerConsumerChannel(this.consumer.getChannel(), getConnectionFactory());
private boolean doReceiveAndExecute(BlockingQueueConsumer consumer) throws Exception { //NOSONAR Channel channel = consumer.getChannel();
new RabbitResourceHolder(consumer.getChannel(), false), getConnectionFactory(), true);
private boolean doReceiveAndExecute(BlockingQueueConsumer consumer) throws Exception { //NOSONAR Channel channel = consumer.getChannel();
@Test public void testSendAndReceiveWithNonDefaultExchange() throws Exception { final RabbitAdmin admin = new RabbitAdmin(connectionFactory); final TopicExchange exchange = new TopicExchange("topic"); admin.declareExchange(exchange); admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("*.end")); template.execute(channel -> { BlockingQueueConsumer consumer = createConsumer(template); String tag = consumer.getConsumerTags().iterator().next(); assertNotNull(tag); template.convertAndSend("topic", "foo", "message"); try { String result = getResult(consumer); assertEquals(null, result); template.convertAndSend("topic", "foo.end", "message"); result = getResult(consumer); assertEquals("message", result); } finally { consumer.getChannel().basicCancel(tag); } return null; }); admin.deleteExchange("topic"); }
@Test public void testSendAndReceiveWithTopicSingleCallback() throws Exception { final RabbitAdmin admin = new RabbitAdmin(connectionFactory); final TopicExchange exchange = new TopicExchange("topic"); admin.declareExchange(exchange); template.setExchange(exchange.getName()); admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("*.end")); template.execute(channel -> { BlockingQueueConsumer consumer = createConsumer(template); String tag = consumer.getConsumerTags().iterator().next(); assertNotNull(tag); template.convertAndSend("foo", "message"); try { String result = getResult(consumer); assertEquals(null, result); template.convertAndSend("foo.end", "message"); result = getResult(consumer); assertEquals("message", result); } finally { consumer.getChannel().basicCancel(tag); } return null; }); admin.deleteExchange("topic"); }