On Thu, Sep 13, 2012 at 9:04 AM, jimbogaz <jimbo...@gmail.com> wrote: > Thanks for the fast response Claus. I figured that must have been the > case, which is why I then tried implementing the timeout method on a > TimeoutAwareAggregator. I thought if I called setException there (just > with a plain new Exception) then that might trigger the error handler. >
The multicast EIP is not designed to redelivery "all over again". If an exception occurs during processing one of the N multicasted message, then error handling occurs only for that particular message. When timeout is hit it does not cause any exception and therefore continue routing. So even if you set an exception in the timeout aware aggregator, then the EIP was not designed to cause error handling to redeliver from the start again. Its also a bit unusual to retry again, as when timeout is hit, the current in-flight message is still being processed. They are not instant cancelled, as that is not easily doable in Java. If you have a copy of Camel in Action then its most likely easier for you to do something alike show on page 349, starting section from page 357. eg use some java code and deal with timeout and retry yourself. Then you can also have individual timeout settings etc. > I should describe that what I want to happen is that either the whole > multicast tries again, or perhaps just the one that timed out. Is there a > different way of achieving that? > Thanks again, > James > On Sep 13, 2012 8:43 AM, "Claus Ibsen-2 [via Camel]" < > ml-node+s465427n5719232...@n5.nabble.com> wrote: > >> There is no exception occurring. And therefore the error handler does >> not redeliver anything. >> If the timeout is hit on the multicast, then yes the multicast will >> aggregate what it currently has, and continue routing. >> >> >> >> On Wed, Sep 12, 2012 at 10:37 PM, jimbogaz <[hidden >> email]<http://user/SendEmail.jtp?type=node&node=5719232&i=0>> >> wrote: >> >> > Hi all. >> > >> > I think I'm missing something obvious, but I can't find anything here >> that >> > is similar to my problem, or any docs that tell me "it's obvious James >> you >> > twerp": >> > >> > I've put together a route that multicasts to three direct routes, which >> > simply return setBody type responses. I have intentionally made one of >> them >> > take longer than the timeout on the multicast, with the intention that >> the >> > error handler retries the request. It doesn't. I have tried with both >> > having a TimeoutAwareAggregationStrategy with a setException (which I >> > thought would automatically invoke the error handler), and with just a >> plain >> > AggregationStrategy. >> > >> > I'm on Camel 2.9.3, and below are my (sanitised to protect my client) >> > sections from beans.xml and my main method... can anybody tell me where >> I'm >> > epic failing? >> > >> > >> > public static void main(String... args) throws Exception { >> > ApplicationContext appContext = new >> > ClassPathXmlApplicationContext("beans.xml"); >> > LOG.info("Initialised Application Context"); >> > CamelContext camelContext = appContext.getBean("camel-context", >> > CamelContext.class); >> > ProducerTemplate producerTemplate = >> > camelContext.createProducerTemplate(); >> > producerTemplate.asyncCallbackRequestBody("direct:blah", >> > "<identity><name>James</name>[hidden >> > email]<http://user/SendEmail.jtp?type=node&node=5719232&i=1></identity>", >> callback); >> > Thread.sleep(15000); >> > LOG.info("FINISHED"); >> > } >> > >> > <camel:camelContext id="camel-context" errorHandlerRef="defaultEH" >> > xmlns="http://camel.apache.org/schema/spring"> >> > <camel:package>com.rightmess.camel</camel:package> >> > >> > <camel:errorHandler id="defaultEH"> >> > <camel:redeliveryPolicy maximumRedeliveries="2" >> > retryAttemptedLogLevel="WARN" redeliveryDelay="200"/> >> > </camel:errorHandler> >> > <camel:route> >> > <camel:from uri="direct:blah"/> >> > <camel:multicast strategyRef="aggregatedData" >> > parallelProcessing="true" streaming="true" >> timeout="700"> >> > <camel:to uri="direct:DOB"/> >> > <camel:to uri="direct:Address"/> >> > <camel:to uri="direct:Telephone"/> >> > </camel:multicast> >> > </camel:route> >> > <camel:route> >> > <camel:from uri="direct:DOB"/> >> > <camel:delay><camel:constant>233</camel:constant></camel:delay> >> > >> > >> <camel:setBody><camel:constant>15/04/1868</camel:constant></camel:setBody> >> > </camel:route> >> > <camel:route> >> > <camel:from uri="direct:Address"/> >> > <camel:delay><camel:constant>1500</camel:constant></camel:delay> >> > >> > >> <camel:setBody><camel:constant>Starbucks</camel:constant></camel:setBody> >> > <camel:to uri="log:log"/> >> > </camel:route> >> > <camel:route> >> > <camel:from uri="direct:Telephone"/> >> > <camel:delay><camel:constant>233</camel:constant></camel:delay> >> > >> > >> <camel:setBody><camel:constant>0982734786238746</camel:constant></camel:setBody> >> >> > </camel:route> >> > </camel:camelContext> >> > >> > >> > >> > >> > >> > -- >> > View this message in context: >> http://camel.465427.n5.nabble.com/Multicast-redelivery-and-error-handlers-tp5719208.html >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> >> >> >> -- >> Claus Ibsen >> ----------------- >> FuseSource >> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719232&i=2> >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://camel.465427.n5.nabble.com/Multicast-redelivery-and-error-handlers-tp5719208p5719232.html >> To unsubscribe from Multicast, redelivery and error handlers, click >> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5719208&code=amltYm9nYXpAZ21haWwuY29tfDU3MTkyMDh8LTEyOTI5MDU2OTA=> >> . >> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Multicast-redelivery-and-error-handlers-tp5719208p5719236.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen