Package org.springframework.amqp.rabbit.config

Examples of org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean


    ConnectionFactory connectionFactory = ctx.getBean(ConnectionFactory.class);
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setMessageListener(new MessageListenerAdapter(new POJO()));
    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();

    // use an external template so we can share his cache
    RetryTemplate retryTemplate = new RetryTemplate();
    RetryContextCache cache = new MapRetryContextCache();
    retryTemplate.setRetryContextCache(cache);
    fb.setRetryOperations(retryTemplate);

    // give him a reference to the retry cache so he can clean it up
    MissingMessageIdAdvice missingIdAdvice = new MissingMessageIdAdvice(cache);

    Advice retryInterceptor = fb.getObject();
    // add both advices
    container.setAdviceChain(new Advice[] {missingIdAdvice, retryInterceptor});
    container.start();

    template.convertAndSend("retry.test.exchange", "retry.test.binding", "Hello, world!");
View Full Code Here


    ConnectionFactory connectionFactory = ctx.getBean(ConnectionFactory.class);
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setMessageListener(new MessageListenerAdapter(new POJO()));
    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();

    // use an external template so we can share his cache
    RetryTemplate retryTemplate = new RetryTemplate();
    RetryContextCache cache = new MapRetryContextCache();
    retryTemplate.setRetryContextCache(cache);
    fb.setRetryOperations(retryTemplate);
    fb.setMessageRecoverer(new RejectAndDontRequeueRecoverer());

    // give him a reference to the retry cache so he can clean it up
    MissingMessageIdAdvice missingIdAdvice = new MissingMessageIdAdvice(cache);

    Advice retryInterceptor = fb.getObject();
    // add both advices
    container.setAdviceChain(new Advice[] {missingIdAdvice, retryInterceptor});
    container.start();

    MessageProperties messageProperties = new MessageProperties();
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.