EventBinder { void bindQueue(final QueueBinding queueBinding) { @SuppressWarnings("unchecked") Event<Object> eventControl = (Event<Object>)remoteEventControl.select(queueBinding.eventType); @SuppressWarnings("unchecked") Instance<Object> eventPool = (Instance<Object>)remoteEventPool.select(queueBinding.eventType); EventConsumer consumer = new EventConsumer(eventControl, eventPool); consumerContainer.addConsumer(consumer, queueBinding.queue, queueBinding.autoAck); LOGGER.info("Binding between queue {} and event type {} activated", queueBinding.queue, queueBinding.eventType.getSimpleName()); }  void initialize(); EventBindingBuilder bind(Class<?> event);  }
@Test public void testBindQueue() { eventBinder.bind(TestEventOne.class).toQueue(TestSetup.TEST_QUEUE_ONE); eventBinder.bind(TestEventTwo.class).toQueue(TestSetup.TEST_QUEUE_TWO).autoAck(); eventBinder.processQueueBindings(); List<ConsumerContainer.ConsumerHolder> consumers = eventBinder.consumerContainer.getInactiveConsumers(); Collections.sort(consumers, new MessageConsumerComparator()); Assert.assertEquals(2, consumers.size()); ConsumerContainer.ConsumerHolder consumerOne = consumers.get(0); ConsumerContainer.ConsumerHolder consumerTwo = consumers.get(1); Assert.assertEquals(TestSetup.TEST_QUEUE_ONE, consumerOne.getConfiguration().getQueueName()); Assert.assertEquals(TestSetup.TEST_QUEUE_TWO, consumerTwo.getConfiguration().getQueueName()); Assert.assertFalse(consumerOne.getConfiguration().isAutoAck()); Assert.assertTrue(consumerTwo.getConfiguration().isAutoAck()); }