Example usage for org.springframework.amqp.rabbit.config StatelessRetryOperationsInterceptorFactoryBean StatelessRetryOperationsInterceptorFactoryBean

List of usage examples for org.springframework.amqp.rabbit.config StatelessRetryOperationsInterceptorFactoryBean StatelessRetryOperationsInterceptorFactoryBean

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.config StatelessRetryOperationsInterceptorFactoryBean StatelessRetryOperationsInterceptorFactoryBean.

Prototype

StatelessRetryOperationsInterceptorFactoryBean

Source Link

Usage

From source file:org.springframework.integration.x.rabbit.RabbitMessageBus.java

private void doRegisterConsumer(String name, MessageChannel moduleInputChannel, Queue queue) {
    SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(
            this.connectionFactory);
    if (this.concurrentConsumers != null) {
        listenerContainer.setConcurrentConsumers(this.concurrentConsumers);
    }/*from   ww  w.jav a2s.  com*/
    listenerContainer.setQueues(queue);
    Advice advice = new StatelessRetryOperationsInterceptorFactoryBean().getObject();
    listenerContainer.setAdviceChain(new Advice[] { advice });
    listenerContainer.afterPropertiesSet();
    AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(listenerContainer);
    DirectChannel bridgeToModuleChannel = new DirectChannel();
    bridgeToModuleChannel.setBeanName(name + ".bridge");
    adapter.setOutputChannel(bridgeToModuleChannel);
    adapter.setHeaderMapper(this.mapper);
    adapter.setBeanName("inbound." + name);
    adapter.afterPropertiesSet();
    addBinding(Binding.forConsumer(adapter, moduleInputChannel));
    ReceivingHandler convertingBridge = new ReceivingHandler();
    convertingBridge.setOutputChannel(moduleInputChannel);
    convertingBridge.setBeanName(name + ".convert.bridge");
    convertingBridge.afterPropertiesSet();
    bridgeToModuleChannel.subscribe(convertingBridge);
    adapter.start();
}