AmqpPollableMessageChannelSpec(AmqpChannelFactoryBean amqpChannelFactoryBean, ConnectionFactory connectionFactory) { this.amqpChannelFactoryBean = amqpChannelFactoryBean; this.amqpChannelFactoryBean.setConnectionFactory(connectionFactory); this.amqpChannelFactoryBean.setSingleton(false); this.amqpChannelFactoryBean.setPubSub(false); /* We need this artificial BeanFactory to overcome AmqpChannelFactoryBean initialization. The real BeanFactory will be applied later for the target AbstractAmqpChannel instance. */ this.amqpChannelFactoryBean.setBeanFactory(new DefaultListableBeanFactory()); }
@Test public void testAmqpChannelFactoryBean() throws Exception { AmqpChannelFactoryBean channelFactoryBean = new AmqpChannelFactoryBean(); channelFactoryBean.setBeanFactory(mock(BeanFactory.class)); channelFactoryBean.setConnectionFactory(this.connectionFactory); channelFactoryBean.setBeanName("testChannel"); channelFactoryBean.afterPropertiesSet(); AbstractAmqpChannel channel = channelFactoryBean.getObject(); assertThat(channel, instanceOf(PointToPointSubscribableAmqpChannel.class)); channelFactoryBean = new AmqpChannelFactoryBean(); channelFactoryBean.setBeanFactory(mock(BeanFactory.class)); channelFactoryBean.setConnectionFactory(this.connectionFactory); channelFactoryBean.setBeanName("testChannel"); channelFactoryBean.setPubSub(true); channelFactoryBean.afterPropertiesSet(); channel = channelFactoryBean.getObject(); assertThat(channel, instanceOf(PublishSubscribeAmqpChannel.class)); RabbitAdmin rabbitAdmin = new RabbitAdmin(this.connectionFactory); rabbitAdmin.deleteQueue("testChannel"); rabbitAdmin.deleteExchange("si.fanout.testChannel"); }
AmqpPollableMessageChannelSpec(AmqpChannelFactoryBean amqpChannelFactoryBean, ConnectionFactory connectionFactory) { this.amqpChannelFactoryBean = amqpChannelFactoryBean; this.amqpChannelFactoryBean.setConnectionFactory(connectionFactory); this.amqpChannelFactoryBean.setSingleton(false); this.amqpChannelFactoryBean.setPubSub(false); /* We need this artificial BeanFactory to overcome AmqpChannelFactoryBean initialization. The real BeanFactory will be applied later for the target AbstractAmqpChannel instance. */ this.amqpChannelFactoryBean.setBeanFactory(new DefaultListableBeanFactory()); }
AmqpPollableMessageChannelSpec(AmqpChannelFactoryBean amqpChannelFactoryBean, ConnectionFactory connectionFactory) { this.amqpChannelFactoryBean = amqpChannelFactoryBean; this.amqpChannelFactoryBean.setConnectionFactory(connectionFactory); this.amqpChannelFactoryBean.setSingleton(false); this.amqpChannelFactoryBean.setPubSub(false); /* We need this artificial BeanFactory to overcome AmqpChannelFactoryBean initialization. The real BeanFactory will be applied later for the target AbstractAmqpChannel instance. */ this.amqpChannelFactoryBean.setBeanFactory(new DefaultListableBeanFactory()); }
AmqpPollableMessageChannelSpec(AmqpChannelFactoryBean amqpChannelFactoryBean, ConnectionFactory connectionFactory) { this.amqpChannelFactoryBean = amqpChannelFactoryBean; this.amqpChannelFactoryBean.setConnectionFactory(connectionFactory); this.amqpChannelFactoryBean.setSingleton(false); this.amqpChannelFactoryBean.setPubSub(false); /* We need this artificial BeanFactory to overcome AmqpChannelFactoryBean initialization. The real BeanFactory will be applied later for the target AbstractAmqpChannel instance. */ this.amqpChannelFactoryBean.setBeanFactory(new DefaultListableBeanFactory()); }