camel multicast
Hi I am using camel 2.4 I know its a old version of camel but I need a help badly I am using multiacast to process same message differently. I wanted to replies from both the message ,so if one endpoint fails to process the message ,the 2nd endpoint also stop the processing and the message will go to the errorHandle block. for that i am using customAggregationStrategy so i can get a control of both the endpoints . But dont know what is wrong in my code because control never enters in customAggregationStrategy class So i cant check the replies from endpoints Please look the code below and help me out - - - - ${header.CamelFileNameOnly} contains ${properties:xml_prefix} - eformular/forminfo/orgg/text() - eformular/forminfo/ename/text() - xsdFile - - ${header.checkMyC} == 'YES' - - - ${header.OUTBOX} == null - ${header.MEP} != null - - - java.lang.Exception - true - - - - - xsltFile - xsd_After_xslt - - - myCommitxsltFile - xsd_ME_afterXslt - - ${properties:outbox}/${header.org}/ - outbox - Thank you -- View this message in context: http://camel.465427.n5.nabble.com/camel-multicast-tp5732682.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel multicast
Did you set the stopOnException option to be true in your multicast? -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Friday, May 17, 2013 at 2:00 AM, Nibs wrote: > Hi > I am using camel 2.4 > I know its a old version of camel but I need a help badly > > I am using multiacast to process same message differently. > I wanted to replies from both the message ,so if one endpoint fails to > process the message ,the 2nd endpoint also stop the processing and the > message will go to the errorHandle block. > for that i am using customAggregationStrategy so i can get a control of both > the endpoints . > > But dont know what is wrong in my code because control never enters in > customAggregationStrategy class > So i cant check the replies from endpoints > > Please look the code below and help me out > > > > > > > > > > - > > > > - > - > - > ${header.CamelFileNameOnly} contains > ${properties:xml_prefix} > - > eformular/forminfo/orgg/text() > > - > eformular/forminfo/ename/text() > > > > > > - > xsdFile > > > > - > - > ${header.checkMyC} == 'YES' > > > - parallelProcessing="true"> > > > > > > - > - > ${header.OUTBOX} == null > > > - > ${header.MEP} != null > > > > > > - > > > > > > - > > > > > - > java.lang.Exception > - > true > > /> > - > > > > - > - > > > - > - > xsltFile > > > - > xsd_After_xslt > > - > > - > > > > - > myCommitxsltFile > > - > xsd_ME_afterXslt > > > > > - > > > > - > ${properties:outbox}/${header.org (http://header.org)}/ > > - > outbox > > > > - > > > Thank you > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/camel-multicast-tp5732682.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: camel multicast
yes I did that but nothing work -- View this message in context: http://camel.465427.n5.nabble.com/camel-multicast-tp5732682p5732698.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel multicast configuration file
Hi Team, I am trying to configure camel multicasting in my project. The requirement is to hit multiple services in parallel and consume the response. When I tried, am getting the response in body of the second service alone. Am not able to get the response of the first service. Please help me on this. I have the configuration file as below. Thanks, Bala -- View this message in context: http://camel.465427.n5.nabble.com/Camel-multicast-configuration-file-tp5723427.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel multicast and exception
Based on this example of a camel route aggregationKey I want to retry independent from each other if one fails. The behavior now is if one fails the three routes will be retried. I tried to do a custom error hander but the behavior was the same. ¿Any idea? Best regards Erwin
Camel multicast and exception
Hi, Below route is giving exception with stackTrace and I want to restrict it to provide only a message instead of stackTrace. Please me to fix it. --- ${header.eventId} ${body} java.lang.Exception java.sql.SQLException Error on ${header.eventId}:${body} ${properties:rest.uri}${header.eventId} GET http://dummyhost"/> insert into XX (ID, TYPE, SOURCE, SUBMITTED_DT, STATUS, CONTROLS, PAYLOAD) values(SEQPW_SUBMISSIONS.NEXTVAL, 'events', 'CM', sysdate, 'NOT_PROCESSED', TO_CLOB('${property.eventDesc}'), utl_raw.cast_to_raw('${body}')) ${property.eventid}:${property.eventdesc} Thanks, Kishore Kumar Desu.
Camel multicast() with aggregationStrategy() ...
I have a Camel route that consumes from *netty:udp* and uses the *multicast() *DSL method to multicast to several different destinations (i.e. Camel throughput logger, local backup file, a SEDA queue that produces to Kafka, and another SEDA queue on a route that contains a UdpAckBack processor that composes an ack for each received UDP datagram). I'm having trouble getting the UDP acks to be sent back to the UDP client. Yes, I know that you don't typically acknowledge received UDP datagrams, but I have a requirement to optionally do so. I'm trying to use an *AggregationStrategy* so that the processed exchange from the multicast destination containing the UdpAckBack processor is sent back as the ack to each of the received UDP datagrams. Additionally, I have to honor an application configuration setting that says whether or not to send UDP acks, so in some cases I'll need to multicast to the above destinations, but with no UDP acks sent back to the UDP client. So my question is, can an *AggregationStrategy* be configured so that it either sends back the result of a particular multicast destination as the UDP ack, and also be setup so that, when configured, no multicast response is sent? I'm kind of stuck with how to implement this kind of aggregation strategy. Maybe I could have the route that contains the UdpAckBack processor set a custom Exchange header that could be examined in the *aggregate(Exchange exchange1, Exchange exchange2) *method? Any help is greatly appreciated!!! Thanks, Steve -- View this message in context: http://camel.465427.n5.nabble.com/Camel-multicast-with-aggregationStrategy-tp5770505.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Multicast sync vs async
Hello Community I have a camel multicast as follows from("jetty:http://0.0.0.0:8081/sort?httpMethodRestrict=PUT";) .convertBodyTo(String.class) .multicast(new ListAggregator()).parallelProcessing().to("direct:A","seda:B","direct:C").end() .log("API response ${body}") .end(); I want one of those 3 branches to be async and don't want multicast to kinda aggregate the result which comes from seda:B route. Is there a way I can achieve that functionality? In above example, I want the aggregator to hit completion criteria once direct:A and direct:C is done its processing. Cheers Reji Mathews
Re: Camel multicast configuration file
Hi See the eip docs http://camel.apache.org/multicast.html And read about the aggregation strategy. On Fri, Nov 30, 2012 at 6:36 AM, Bala wrote: > Hi Team, > > I am trying to configure camel multicasting in my project. The requirement > is to hit multiple services in parallel and consume the response. When I > tried, am getting the response in body of the second service alone. Am not > able to get the response of the first service. Please help me on this. > > I have the configuration file as below. > > > > > > > > > > > > > > > > > > > Thanks, Bala > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-multicast-configuration-file-tp5723427.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Camel multicast configuration file
Hi Bala, > I am trying to configure camel multicasting in my project. The requirement > is to hit multiple services in parallel and consume the response. As Claus suggested you forgot to aggregate the requests. And here's how can you aggregate responses from multiple services: from("direct:serviceAggregator") .multicast(new GroupedExchangeAggregationStrategy()).parallelProcessing() .enrich("http://servicea.com";).enrich("http://serviceb.com";) .end(); Laters. -- Henryk Konsek http://henryk-konsek.blogspot.com
Re: Camel multicast and exception
Take a look at try-catch block. Or try adding exception handlers to each individual "direct" route? On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart wrote: > Based on this example of a camel route > > aggregationRepositoryRef="aggregator.container.2" completionSize="2" > completionTimeout="36"> > > aggregationKey > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I want to retry independent from each other if one fails. The behavior now > is if one fails the three routes will be retried. I tried to do a custom > error hander but the behavior was the same. > > ¿Any idea? > > Best regards > > Erwin > -- *Christian Posta* http://www.christianposta.com/blog twitter: @christianposta
Re: Camel multicast and exception
Thanks for your response Christian, Do you know if i try with "try catch" how can i do to define a redelivery police of this specific direct component? Regards Erwin 2013/9/26 Christian Posta > Take a look at try-catch block. Or try adding exception handlers to each > individual "direct" route? > > > On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart >wrote: > > > Based on this example of a camel route > > > > > aggregationRepositoryRef="aggregator.container.2" completionSize="2" > > completionTimeout="36"> > > > > aggregationKey > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > /> > > > > > > > > > > > > > > I want to retry independent from each other if one fails. The behavior > now > > is if one fails the three routes will be retried. I tried to do a custom > > error hander but the behavior was the same. > > > > ¿Any idea? > > > > Best regards > > > > Erwin > > > > > > -- > *Christian Posta* > http://www.christianposta.com/blog > twitter: @christianposta >
Re: Camel multicast and exception
You can specify an error handler for the specific route which is where you specify redelivery semantics: http://camel.apache.org/error-handler.html On Thu, Sep 26, 2013 at 9:33 AM, Erwin Etchart wrote: > Thanks for your response Christian, > > Do you know if i try with "try catch" how can i do to define a redelivery > police of this specific direct component? > > > Regards > > Erwin > > > > > 2013/9/26 Christian Posta > > > Take a look at try-catch block. Or try adding exception handlers to each > > individual "direct" route? > > > > > > On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart > >wrote: > > > > > Based on this example of a camel route > > > > > > > > aggregationRepositoryRef="aggregator.container.2" completionSize="2" > > > completionTimeout="36"> > > > > > > aggregationKey > > > > > > > > > /> > > > /> > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > uri="bean:spring.remote?method=springRemotingTest2(${body})" > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > uri="bean:spring.remote?method=springRemotingTest3(${body})" > > /> > > > > > > > > > > > > > > > > > > > > > I want to retry independent from each other if one fails. The behavior > > now > > > is if one fails the three routes will be retried. I tried to do a > custom > > > error hander but the behavior was the same. > > > > > > ¿Any idea? > > > > > > Best regards > > > > > > Erwin > > > > > > > > > > > -- > > *Christian Posta* > > http://www.christianposta.com/blog > > twitter: @christianposta > > > -- *Christian Posta* http://www.christianposta.com/blog twitter: @christianposta
Re: Camel multicast and exception
Thanks , i will try that. Regards Erwin 2013/9/26 Christian Posta > You can specify an error handler for the specific route which is where you > specify redelivery semantics: > > http://camel.apache.org/error-handler.html > > > On Thu, Sep 26, 2013 at 9:33 AM, Erwin Etchart >wrote: > > > Thanks for your response Christian, > > > > Do you know if i try with "try catch" how can i do to define a > redelivery > > police of this specific direct component? > > > > > > Regards > > > > Erwin > > > > > > > > > > 2013/9/26 Christian Posta > > > > > Take a look at try-catch block. Or try adding exception handlers to > each > > > individual "direct" route? > > > > > > > > > On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart < > erwin.etch...@gmail.com > > > >wrote: > > > > > > > Based on this example of a camel route > > > > > > > > > > > aggregationRepositoryRef="aggregator.container.2" completionSize="2" > > > > completionTimeout="36"> > > > > > > > > aggregationKey > > > > > > > > > > > > > /> > > > > > /> > > > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > uri="bean:spring.remote?method=springRemotingTest(${body})" > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > uri="bean:spring.remote?method=springRemotingTest2(${body})" > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > uri="bean:spring.remote?method=springRemotingTest3(${body})" > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > I want to retry independent from each other if one fails. The > behavior > > > now > > > > is if one fails the three routes will be retried. I tried to do a > > custom > > > > error hander but the behavior was the same. > > > > > > > > ¿Any idea? > > > > > > > > Best regards > > > > > > > > Erwin > > > > > > > > > > > > > > > > -- > > > *Christian Posta* > > > http://www.christianposta.com/blog > > > twitter: @christianposta > > > > > > > > > -- > *Christian Posta* > http://www.christianposta.com/blog > twitter: @christianposta >
Re: Camel multicast and exception
Hi You can turn this off on the error handler. It has many options to turn this on | off. You set LogStackTrace = false http://camel.apache.org/redeliverypolicy.html On Mon, Mar 9, 2015 at 10:18 AM, Desu, Kishore Kumar wrote: > Hi, > > Below route is giving exception with stackTrace and I want to restrict it to > provide only a message instead of stackTrace. > Please me to fix it. > --- > > > > > > ${header.eventId} > > > > ${body} > > > > java.lang.Exception > java.sql.SQLException > redeliveryDelay="3000"/> > > Error on ${header.eventId}:${body} > > > > > > > > > ${properties:rest.uri}${header.eventId} > > > > GET > > > http://dummyhost"/> > > > insert into XX (ID, TYPE, SOURCE, > SUBMITTED_DT, STATUS, CONTROLS, PAYLOAD) values(SEQPW_SUBMISSIONS.NEXTVAL, > 'events', 'CM', sysdate, 'NOT_PROCESSED', TO_CLOB('${property.eventDesc}'), > utl_raw.cast_to_raw('${body}')) > > > > > > ${property.eventid}:${property.eventdesc} > > > > > > > Thanks, > Kishore Kumar Desu. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
RE: Camel Multicast sync vs async
Hi Reji, Not sure, but it looks like you want to wiretap the seda:B route while multicasting to the other two. Cheers, Dmitry -Original Message- From: Reji Mathews [mailto:contactr...@gmail.com] Sent: Thursday, July 9, 2020 1:24 PM To: users@camel.apache.org Subject: Camel Multicast sync vs async Hello Community I have a camel multicast as follows from("jetty:https://urldefense.com/v3/__http://0.0.0.0:8081/sort?httpMethodRestrict=PUT__;!!LdWlNaMnLCM!NUvcuGYoOSX9AodBe4MkLfZPuLSR1Qs_ERdbnjXkyoyuOudlHqJ4YWT1NyWFCEAMQ3XY$ ") .convertBodyTo(String.class) .multicast(new ListAggregator()).parallelProcessing().to("direct:A","seda:B","direct:C").end() .log("API response ${body}") .end(); I want one of those 3 branches to be async and don't want multicast to kinda aggregate the result which comes from seda:B route. Is there a way I can achieve that functionality? In above example, I want the aggregator to hit completion criteria once direct:A and direct:C is done its processing. Cheers Reji Mathews
Camel Multicast behaving strangely - please help
Hello All i am getting as strange behavior from camel multicast. Looks like i am doing something wrong but cant point it. Need your help urgently. I a creating a multicast route to two endpoints as below: Start point : direct://start endpoint : direct://route1 endpoint : direct://route2 Routes info : 1) from("direct://start").process(new DeepCloneRequest()).multicast(new Aggregator()).to("direct://route1","direct://route2") 2) from("direct://route1").setheader().process().to("rest url1").processor().end 3) from("direct://route2").setheader().process().to("rest url2").processor().end what i notice is that in my route number 3 in preprocessing i got the exchange out of number 2 preprocessing instead of DeepCloneRequest from nulticast. Can someone please help explain this? I want to get same request that multicast receive in both route 2 and 3. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Multicast behaving strangely - please help
the camel version i am using is 2.17.3 -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319p5791320.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Camel Multicast behaving strangely - please help
Can you try: multicast(.) .to("direct://route1") .to("direct://route2") -Oorspronkelijk bericht- Van: nishat [mailto:nishat.dhil...@gmail.com] Verzonden: Friday 9 December 2016 15:36 Aan: users@camel.apache.org Onderwerp: Camel Multicast behaving strangely - please help Hello All i am getting as strange behavior from camel multicast. Looks like i am doing something wrong but cant point it. Need your help urgently. I a creating a multicast route to two endpoints as below: Start point : direct://start endpoint : direct://route1 endpoint : direct://route2 Routes info : 1) from("direct://start").process(new DeepCloneRequest()).multicast(new Aggregator()).to("direct://route1","direct://route2") 2) from("direct://route1").setheader().process().to("rest processor>url1").processor().end 3) from("direct://route2").setheader().process().to("rest processor>url2").processor().end what i notice is that in my route number 3 in preprocessing i got the exchange out of number 2 preprocessing instead of DeepCloneRequest from nulticast. Can someone please help explain this? I want to get same request that multicast receive in both route 2 and 3. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Camel Multicast behaving strangely - please help
Hello Hans, I tried your suggestion but got the same issue. any other idea? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319p5791327.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Camel Multicast behaving strangely - please help
Thanks for the response. but the problem is that my endpoint are coming from a ArraylistList for multicast. But i will try you suggestion by hard coding it. will let you know in a while. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319p5791322.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Multicast behaving strangely - please help
Hi Nishat, If the request at the endpoint is an ArrayList and you need to send individual elements of that list to different routes, you can also use a splitter to split the body and then parallel process and send it to different routes (instead of multicast). Thanks, Nikhil On Mon, 12 Dec 2016 at 14:00 nishat wrote: > Hello Hans, > > I tried your suggestion but got the same issue. any other idea? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319p5791327.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Camel Multicast behaving strangely - please help
Hello Nikhil, just to clarify the request is a pojo. and i want to send the exact copy of request to the multicasted endpoints. The problem is after first route in multicast, the second route dont get the exact copy of the initial route but a processed copy of first route. hoping to receive some more help form you. also noticed that multicast send the same request object to both routes instead of copy of initial request. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319p5791378.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Multicast behaving strangely - please help
Hey Nishat, I see that you've added the 'new DeepCloneRequest()' in a process() statement rather than a 'onPrepare()'. Can you check the onPrepare section (the last section) for the Camel multicast documentation - http://camel.apache.org/multicast.html Thanks, Nikhil. On Tue, 13 Dec 2016 at 02:16 nishat wrote: > Hello Nikhil, > > just to clarify the request is a pojo. and i want to send the exact copy of > request to the multicasted endpoints. The problem is after first route in > multicast, the second route dont get the exact copy of the initial route > but > a processed copy of first route. hoping to receive some more help form you. > > also noticed that multicast send the same request object to both routes > instead of copy of initial request. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-Multicast-behaving-strangely-please-help-tp5791319p5791378.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Camel Multicast - copying email to two Inbox folders
Hi, We have been using Camel ( version 2.10) to monitor/route and process attachments to emails coming in to one of our mailboxes. At the end of the processing some emails are copied to an Inbox folder using the '.setHeader("copyTo")' method. This has been working quite well. Now the users have asked for a new requirement, where some emails depending on the type of email attachment has to be copied to two Inbox folders. I tried to do this using multicast and a custom onPrepare method on my processor to do a deep copy of the message. But this always copies the email to only one of the folders. following is the route description and custom processor from("direct:incomingValidateAttachments").routeId("direct:incomingValidateAttachments") //check the attachment to see if they are valid .log(LoggingLevel.DEBUG, logger,"direct:incomingValidateAttachments" + logMessage) .doTry() .to("direct:incomingSplitAttachments") .doCatch(Throwable.class) //send the emails with invalid attachment to Inbox/errors folder .log(LoggingLevel.DEBUG, logger, "Error catched") .setHeader("copyTo").constant("Inbox/errors") .end() //copy valid emails two Inbox folders communications and datafeeds .multicast().onPrepare(new MessageClonePrepare())//using custom processor for copying the mail message .to("direct:coptToComms") .to("direct:coptToDataFeeds"); //copy email to communications folder from("direct:coptToComms").routeId("direct:coptToComms") .log(LoggingLevel.DEBUG, logger, "direct:coptToComms" + logMessage) .setHeader("copyTo").constant("Inbox/Comms"); // Send the email to the data feed folder from("direct:coptToDataFeeds").routeId("direct:coptToDataFeeds") .log(LoggingLevel.DEBUG, logger, "direct:coptToDataFeeds" + logMessage) .setHeader("copyTo").constant("Inbox/DataFeeds"); //Class to copy the email message during Multicast import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.NoSuchHeaderException; import org.apache.camel.Processor; import org.apache.camel.component.mail.MailMessage; public class MessageClonePrepare implements Processor { public void process(Exchange exchange) throws NoSuchHeaderException { Message in = exchange.getIn(); Message newMessage = new MailMessage(); newMessage.setBody(in.getBody()); newMessage.setAttachments(in.getAttachments()); newMessage.setHeaders(in.getHeaders()); exchange.setIn(newMessage); } } Please could you help me to find what I am doing wrong? Is using multicast the correct way to copy an email in two Inbox folders? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Multicast-copying-email-to-two-Inbox-folders-tp5772679.html Sent from the Camel - Users mailing list archive at Nabble.com.
How to interrupt camel multicast for subset of enpoints/subroute
Hello folks !!! I have requirement to poll two ftp folders say "output" and "error" for file. Actual file could come in either of two folders(not both). I tried multicast (even used completionSize of 1) but process keeps waiting as camel waits for both output and error endpoint routes to complete. //sample code from("direct:got_filename_to_poll") .multicast() .parallelProcessing(true) .to("ftp:output", "ftp:error") .end() .to("direct:process_extracted_file") Is there any way to interrupt "ftp:error" sub-route if I get response from "ftp:output" sub-route(or vice versa) or is there any other option to solve this problem without compromising response time, example adding timeout on slow response will slow down overall response time. Thanks & Regards Jitesh
Re: How to interrupt camel multicast for subset of enpoints/subroute
Hi Jitesh, You can separate the polling of the two FTP into two separate routes: //normal route from("ftp://[username@]hostname[:port]/output";) //code for normal output .to("direct:process_extracted_file"); //error route from("ftp://[username@]hostname[:port]/error";) //code for error output .to("direct:process_extracted_file"); They can be in the same routebuilder class. Raymond On Mon, Oct 24, 2022 at 12:18 PM Jitesh Adsul wrote: > Hello folks !!! > > I have requirement to poll two ftp folders say "output" and "error" for > file. Actual file could come in either of two folders(not both). I tried > multicast (even used completionSize of 1) but process keeps waiting as > camel waits for both output and error endpoint routes to complete. > > //sample code > > from("direct:got_filename_to_poll") > > .multicast() .parallelProcessing(true) .to("ftp:output", "ftp:error") > .end() > > .to("direct:process_extracted_file") > > Is there any way to interrupt "ftp:error" sub-route if I get response from > "ftp:output" sub-route(or vice versa) or is there any other option to solve > this problem without compromising response time, example adding timeout on > slow response will slow down overall response time. > > > > Thanks & Regards > > Jitesh >
Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
Please excuse stupidity as this is my first Camel application 1. To respond to a web request, I am sourcing the content from two different sources. 2. I am, therefore, making a multicast request to two methods and parallelizing it. 3. The response is an marshalled JSON object (using camel-jackson) All works fine. public class RestToBeanRouter extends RouteBuilder{ @Override public void configure() throws Exception { from("cxfrs://bean://rsServer") .multicast() .parallelProcessing() .aggregationStrategy(new CoreSearchResponseAggregator()) .beanRef("searchRestServiceImpl", "firstMethod") .beanRef("searchRestServiceImpl", "secondMethod") .end() .marshal().json(JsonLibrary.Jackson) .to("log://camelLogger?level=DEBUG"); } **Question :** The Multicast routing expects a `to` in the DSL. Currently, I am mapping this to a `log` endpoint. Is this fine? Since I am not using the `to` and the last exchange of the Aggregator strategy is the one which is returned to the user, should my endpoint be configured to something else - like a null or something? (Ah, the stupidity kicks in) -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
This doesn't sounds right. Can you provide a unit test which shows this behavior and attach it to a JIRA [1]!? [1] http://camel.apache.org/contributing.html Best, Christian - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Tue, Oct 1, 2013 at 12:28 PM, arunodhaya80 wrote: > Please excuse stupidity as this is my first Camel application > > 1. To respond to a web request, I am sourcing the content from two > different > sources. > 2. I am, therefore, making a multicast request to two methods and > parallelizing it. > 3. The response is an marshalled JSON object (using camel-jackson) > > All works fine. > > public class RestToBeanRouter extends RouteBuilder{ > > @Override > public void configure() throws Exception { > > from("cxfrs://bean://rsServer") > > .multicast() > .parallelProcessing() > .aggregationStrategy(new CoreSearchResponseAggregator()) > .beanRef("searchRestServiceImpl", "firstMethod") > .beanRef("searchRestServiceImpl", "secondMethod") > .end() > .marshal().json(JsonLibrary.Jackson) > .to("log://camelLogger?level=DEBUG"); > > } > > > **Question :** > > The Multicast routing expects a `to` in the DSL. Currently, I am mapping > this to a `log` endpoint. Is this fine? > > Since I am not using the `to` and the last exchange of the Aggregator > strategy is the one which is returned to the user, should my endpoint be > configured to something else - like a null or something? (Ah, the stupidity > kicks in) > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
It would work. Multicast doesnt indicate anything more than more than one destination. Those destinations could be two JMS queues, a queue and a log, whatever you like. All your code would do is log the message but if that is what you want then go for it. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39* On Tue, Oct 1, 2013 at 4:34 PM, Christian Müller < christian.muel...@gmail.com> wrote: > This doesn't sounds right. > Can you provide a unit test which shows this behavior and attach it to a > JIRA [1]!? > > [1] http://camel.apache.org/contributing.html > > Best, > Christian > - > > Software Integration Specialist > > Apache Camel committer: https://camel.apache.org/team > V.P. Apache Camel: https://www.apache.org/foundation/ > Apache Member: https://www.apache.org/foundation/members.html > > https://www.linkedin.com/pub/christian-mueller/11/551/642 > > > On Tue, Oct 1, 2013 at 12:28 PM, arunodhaya80 wrote: > > > Please excuse stupidity as this is my first Camel application > > > > 1. To respond to a web request, I am sourcing the content from two > > different > > sources. > > 2. I am, therefore, making a multicast request to two methods and > > parallelizing it. > > 3. The response is an marshalled JSON object (using camel-jackson) > > > > All works fine. > > > > public class RestToBeanRouter extends RouteBuilder{ > > > > @Override > > public void configure() throws Exception { > > > > from("cxfrs://bean://rsServer") > > > > .multicast() > > .parallelProcessing() > > .aggregationStrategy(new CoreSearchResponseAggregator()) > > .beanRef("searchRestServiceImpl", "firstMethod") > > .beanRef("searchRestServiceImpl", "secondMethod") > > .end() > > .marshal().json(JsonLibrary.Jackson) > > .to("log://camelLogger?level=DEBUG"); > > > > } > > > > > > **Question :** > > > > The Multicast routing expects a `to` in the DSL. Currently, I am mapping > > this to a `log` endpoint. Is this fine? > > > > Since I am not using the `to` and the last exchange of the Aggregator > > strategy is the one which is returned to the user, should my endpoint be > > configured to something else - like a null or something? (Ah, the > stupidity > > kicks in) > > > > > > > > -- > > View this message in context: > > > http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > >
Re: Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
Hi Yeah I dont see a problem either. Multicast can be 1 or N destinations. Maybe you can try explain again what you see as a problem? and what you want to do be able to do instead. Are you wanting to do a multicast to zero destinations which doesnt make sense? On Wed, Oct 2, 2013 at 7:44 AM, kraythe . wrote: > It would work. Multicast doesnt indicate anything more than more than one > destination. Those destinations could be two JMS queues, a queue and a log, > whatever you like. All your code would do is log the message but if that is > what you want then go for it. > > *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* > *Author of: Hardcore Java (2003) and Maintainable Java (2012)* > *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39* > > > On Tue, Oct 1, 2013 at 4:34 PM, Christian Müller < > christian.muel...@gmail.com> wrote: > >> This doesn't sounds right. >> Can you provide a unit test which shows this behavior and attach it to a >> JIRA [1]!? >> >> [1] http://camel.apache.org/contributing.html >> >> Best, >> Christian >> - >> >> Software Integration Specialist >> >> Apache Camel committer: https://camel.apache.org/team >> V.P. Apache Camel: https://www.apache.org/foundation/ >> Apache Member: https://www.apache.org/foundation/members.html >> >> https://www.linkedin.com/pub/christian-mueller/11/551/642 >> >> >> On Tue, Oct 1, 2013 at 12:28 PM, arunodhaya80 wrote: >> >> > Please excuse stupidity as this is my first Camel application >> > >> > 1. To respond to a web request, I am sourcing the content from two >> > different >> > sources. >> > 2. I am, therefore, making a multicast request to two methods and >> > parallelizing it. >> > 3. The response is an marshalled JSON object (using camel-jackson) >> > >> > All works fine. >> > >> > public class RestToBeanRouter extends RouteBuilder{ >> > >> > @Override >> > public void configure() throws Exception { >> > >> > from("cxfrs://bean://rsServer") >> > >> > .multicast() >> > .parallelProcessing() >> > .aggregationStrategy(new CoreSearchResponseAggregator()) >> > .beanRef("searchRestServiceImpl", "firstMethod") >> > .beanRef("searchRestServiceImpl", "secondMethod") >> > .end() >> > .marshal().json(JsonLibrary.Jackson) >> > .to("log://camelLogger?level=DEBUG"); >> > >> > } >> > >> > >> > **Question :** >> > >> > The Multicast routing expects a `to` in the DSL. Currently, I am mapping >> > this to a `log` endpoint. Is this fine? >> > >> > Since I am not using the `to` and the last exchange of the Aggregator >> > strategy is the one which is returned to the user, should my endpoint be >> > configured to something else - like a null or something? (Ah, the >> stupidity >> > kicks in) >> > >> > >> > >> > -- >> > View this message in context: >> > >> http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664.html >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> > >> -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
Apologies for not making myself clear enough. As you could see, I am using Camel to route the request to a REST service to two bean methods. These bean methods enrich a single Entity through the AggregationStrategy configured in the multicast. My understanding is that the last exchange returned by the AggregationStrategy is the one which gets returned to the user via the REST response. Is it correct? That being the case, I am not using the `to` at all. Am I using the `to` to just to satisfy the compiler. I don't, in fact, need to log the output. -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664p5740780.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
The aggregated exchange is the one that gets returned and how the aggregated exchange is created depends on the aggregation strategy you use. When a route stops either by calling stop or merely not routing anymore, the exchange on the last part of the route could be considered a reply. In most cases it will reply back to the caller (unless you set a reply-to destination in a JMS based route or some other cases). In your case if all you want to do is return the enriched exchange then you dont need any to() call. Just stop after the marshal. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39* On Wed, Oct 2, 2013 at 1:21 PM, arunodhaya80 wrote: > Apologies for not making myself clear enough. > > As you could see, I am using Camel to route the request to a REST service > to > two bean methods. These bean methods enrich a single Entity through the > AggregationStrategy configured in the multicast. > > My understanding is that the last exchange returned by the > AggregationStrategy is the one which gets returned to the user via the REST > response. Is it correct? > > That being the case, I am not using the `to` at all. Am I using the `to` > to > just to satisfy the compiler. I don't, in fact, need to log the output. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664p5740780.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Apache Camel - Multicast - Is there a 'null' or a similar endpoint ?
Great !! Thanks a lot for explaining this in detail. My bad. For some reason I felt that the route is not complete and that the compiler would complain without a "to". I removed that "to" now and this is exactly what I need. Thank a lot to everybody else for taking the time to make this clear. Though this is my first project with Camel, I am loving it a lot. Now, the community is one more reason. Cheers, Arun Manivannan On Friday, 4 October, 2013 at 12:44 PM, kraythe [via Camel] wrote: > The aggregated exchange is the one that gets returned and how the > aggregated exchange is created depends on the aggregation strategy you use. > When a route stops either by calling stop or merely not routing anymore, > the exchange on the last part of the route could be considered a reply. In > most cases it will reply back to the caller (unless you set a reply-to > destination in a JMS based route or some other cases). In your case if all > you want to do is return the enriched exchange then you dont need any to() > call. Just stop after the marshal. > > *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* > *Author of: Hardcore Java (2003) and Maintainable Java (2012)* > *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39* > > > On Wed, Oct 2, 2013 at 1:21 PM, arunodhaya80 <[hidden email] > (/user/SendEmail.jtp?type=node&node=5740851&i=0)> wrote: > > > Apologies for not making myself clear enough. > > > > As you could see, I am using Camel to route the request to a REST service > > to > > two bean methods. These bean methods enrich a single Entity through the > > AggregationStrategy configured in the multicast. > > > > My understanding is that the last exchange returned by the > > AggregationStrategy is the one which gets returned to the user via the REST > > response. Is it correct? > > > > That being the case, I am not using the `to` at all. Am I using the `to` > > to > > just to satisfy the compiler. I don't, in fact, need to log the output. > > > > > > > > -- > > View this message in context: > > http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664p5740780.html > > Sent from the Camel - Users mailing list archive at Nabble.com > > (http://Nabble.com). > > > > > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664p5740851.html > > To unsubscribe from Apache Camel - Multicast - Is there a 'null' or a similar > endpoint ?, click here > (http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5740664&code=dGVjaEBhcnVubWEuY29tfDU3NDA2NjR8LTEzNjIxMTkxNjc=). > 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/Apache-Camel-Multicast-Is-there-a-null-or-a-similar-endpoint-tp5740664p5740854.html Sent from the Camel - Users mailing list archive at Nabble.com.