[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

redeliveries not working for rabbitmq endpoint


Hello,

I have a flow where messages are put in a blocking queue (seda) and from that queue messages are sent to a RabbitMQ exchange. If the message cannot be put in the queue (e.g. because it has reached its maximum size) an IllegalStateException is thrown. I catch this exception and throw a custom SedaQueueFullException instead, which is caught by the onException block. Trying to put the message on the queue will be tried indefinitely and before the first redelivery an email notification will be sent (implemented in the redeliveryProcessor). All of this works fine.

The same functionality (infinite retries, sending mail before first redelivery) should be applied when sending the message to the RabbitMQ exchange. However, when I intentionally use a non-existing exchange name "e.bho.main.localX" (or when I blackhole the IP address of the RabbitMQ broker) I don't see any retries. Logs are show below. What can be the reason of this?

I'm using Camel 2.20.2.


from("direct:distribute")

.onException( SedaQueueFullException.class)
                                // infinite retries + send mail before first retry
                                               .logStackTrace(true)
                                               .logRetryAttempted(true)
                                               .logRetryStackTrace(true)
                                               .retryAttemptedLogLevel(LoggingLevel.WARN)
                                               .maximumRedeliveries(-1)
                                               .redeliveryDelay(1875)
                                               .backOffMultiplier(2)
                                               .maximumRedeliveryDelay(60*60*1000)
                                               .onRedeliveryRef("redeliveryProcessor")
                                .end()

.doTry()
                                                .to("seda:distribution?waitForTaskToComplete=never&size={{seda.distribution.size}}")
                               .doCatch(IllegalStateException.class)
                                               .throwException(new SedaQueueFullException("Message could not be added to message distribution queue"))
                               .end()
.log(LoggingLevel.INFO, "Message added to blocking queue");


                from("seda:distribution?concurrentConsumers=1&size={{seda.distribution.size}}")

                               .onException(QueuePublishException.class)
                                   .logStackTrace(true)
                                               .logRetryAttempted(true)
                                               .logRetryStackTrace(true)
                                               .retryAttemptedLogLevel(LoggingLevel.WARN)
                                               .maximumRedeliveries(-1)
                                               .redeliveryDelay(1875)
                                               .backOffMultiplier(2)
                                               .maximumRedeliveryDelay(60*60*1000)
                                               .onRedeliveryRef("redeliveryProcessor")
                               .end()

                               .log(LoggingLevel.INFO, "Sending message with UUID=${property.uuid} to {{rabbit.bho_main.exchange}}")
                .doTry()
                                .to("{{rabbit.component}}{{rabbit.address}}{{rabbit.bho_main.exchange}}{{rabbit.bho_main.options}}{{rabbit.credentials}}")
                .doCatch(Exception.class)
                               .throwException(new QueuePublishException("Could not publish message to BHO main exchange"))
                               .end()
                               .log(LoggingLevel.INFO, "Sent message with UUID=${property.uuid} to {{rabbit.bho_main.exchange}}");


INFO  2018-04-09 10:12:56,533 [(4) Threads][route2][]: Message added to blocking queue
INFO  2018-04-09 10:12:56,534 [(3) seda://distribution][route3][ID-BEGHE1L8KB0KC2-1523261571152-0-4]: Sending message with UUID=K7sVEbeASVOYLm93yPFltA to e.bho.main.localX
DEBUG 2018-04-09 10:12:56,541 [(3) seda://distribution][o.a.c.component.rabbitmq.RabbitMQMessagePublisher][ID-BEGHE1L8KB0KC2-1523261571152-0-4]: Sending message to exchange: e.bho.main.localX with CorrelationId = null
DEBUG 2018-04-09 10:12:56,545 [(3) seda://distribution][o.a.c.component.rabbitmq.RabbitMQMessagePublisher][ID-BEGHE1L8KB0KC2-1523261571152-0-4]: Waiting for publisher acknowledgements for 5000ms
WARN  2018-04-09 10:12:56,555 [(3) seda://distribution][org.apache.camel.component.seda.SedaConsumer][]: Error processing exchange. Exchange[]. Caused by: [be.myapp.exception.QueuePublishException - Could not publish message to BHO main exchange]
be.myapp.exception.QueuePublishException: Could not publish message to BHO main exchange
                at be.myapp.routes.HTTPRoutes.configure(HTTPRoutes.java:196)
                at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:462)
                at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:402)
                at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:383)
                at org.apache.camel.impl.DefaultCamelContext$1.call(DefaultCamelContext.java:1032)
                at org.apache.camel.impl.DefaultCamelContext$1.call(DefaultCamelContext.java:1029)
                at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3268)
                at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:1029)
                at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.installRoutes(AbstractCamelContextFactoryBean.java:1053)
                at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.setupRoutes(AbstractCamelContextFactoryBean.java:451)
                at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:363)
                at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:416)
                at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
                at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
                at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
                at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
                at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
                at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
                at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
                at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:222)
                at org.apache.camel.spring.Main.doStart(Main.java:154)
                at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
                at org.apache.camel.main.MainSupport.run(MainSupport.java:170)
                at be.myapp.App.main(App.java:38)






Visit us at www.thomascook.com<http://www.thomascook.com/>, Thomas Cook stores nationwide.

This email is confidential, may be legally privileged and is for the intended recipient only. Access, disclosure, copying, distribution or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error.

Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be otherwise.

Thomas Cook Group UK Limited
Registered Office - Westpoint, Peterborough Business Park, Lynch Wood, Peterborough, PE2 6FZ
Company registration number: 2319744 England