For some reason my queue is not created as durable even though I specify that setting within the Spring AMQP Queue configuration:
@Bean
Queue queue() {
//durable queue - true
return new Queue(queueName, true);
}
I am the using Spring AMQP to connect to RabbitMQ and listen to that Queue on a Direct Exchange.
@Bean
DirectExchange exchange() {
return new DirectExchange(exchangeName);
}
@Bean
Binding binding(Queue queue, DirectExchange exchange) {
return BindingBuilder.bind(queue).to(exchange).with(queueName);
}
@Bean
public ConnectionFactory connectionFactory() {
CloudFactory cloudFactory = new CloudFactory();
Cloud cloud = cloudFactory.getCloud();
AmqpServiceInfo serviceInfo = (AmqpServiceInfo)
cloud.getServiceInfo(serviceName);
CachingConnectionFactory connectionFactory =
new CachingConnectionFactory(serviceInfo.getHost());
connectionFactory.setUsername(serviceInfo.getUserName());
connectionFactory.setPassword(serviceInfo.getPassword());
connectionFactory.setVirtualHost(serviceInfo.getVirtualHost());
return connectionFactory;
}
@Bean
MessageListenerAdapter underwritingMessageListener() throws Exception {
return new MessageListenerAdapter(new UnderwritingMessageListener()) {{
setDefaultListenerMethod("onMessage");
}};
}
@Bean
SimpleMessageListenerContainer container(ConnectionFactory connectionFactory,
MessageListenerAdapter underwritingMessageListener) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueueNames(queueName);
container.setMessageListener(underwritingMessageListener);
return container;
}
Am I missing a configuration step?