Hi Maybe take a look at interceptors http://camel.apache.org/intercept
On Wed, Mar 20, 2013 at 1:28 AM, santhosh <ramukhsohtna...@gmail.com> wrote: > My architecture needs to multicast to multiple endpoints which will be > constructed dynamically and before the message is sent to end point it needs > to be customized.Now its like > > <multicast parallelProcessing="true" streaming="true" > id="staticrecipient " > strategyRef="StringAggregationStrategy" > timeout="2500" > onPrepareRef="StringDeepClonePrepare"> > > <to uri="direct:A" /> > <to uri="direct:B" /> > > </multicast> > > <route id="AClient"> > <from uri="direct:A" /> > <camel:setHeader headerName="A"> <!- some endpoint specific > manipulation > similar to this--> > <camel:constant >Sending to A</camel:constant> <!- some endpoint > specific > manipulation similar to this--> > </camel:setHeader> > <to uri="http://A.com"></to> > </route> > > Now we are moving away from static recipient list list to dynamic recipient > list > > <recipientList parallelProcessing="true" streaming="true" > id="dyanmicrecipient " > strategyRef="StringAggregationStrategy" > timeout="3000" > onPrepareRef="StringDeepClonePrepare"> > > > <what should come here for spring DSL.cant find it in doc.I can use Header > based receipient list but just asking> > *<method(MessageRouter.class, > "routeTo")>* > > </recipientList > > > The method routeTo will return url like A.com,B.com(left out http protocal > due to hyperlink issues) ... depending upon incoming message.i am assuming > camel-http will automatically take care of endpoint creation.correct me if i > am wrong. > > Everything is same as previous but except i am trying to do everything > within multicast /recipientList list without defining additional routes > because i dont know the routes during compile time. > 1)Can i use onPrep processor in some way.cant think of it because i dont > know which exchange is used for which endpoint.If i know endpoint in > exchange properties , then i think i can manipulate it > > very high level of something what i think > > public class OnPrepare implements Processor { > public void process(Exchange exchange) throws Exception { > //i know this function doesnt exist > String toURI=exchange.getTOUri() > //then perform endpoint based manipulation of message > > > } > > } > > Can opPrep be used for this.is it only for things like clone. > > 2)Can i use intercept only for receipient list only. > Problems: > 1)i dont want to use intercept for whole route and filter based on > predicate. > 2)I cant use interceptToSendEndpoint because i dont know endpoint at compile > time. > 3)In short,i want to intercept the message. In multicast ,say if its sent to > Endpoint A then add header A in intercept bean.In multicast ,say if its sent > to Endpoint B then add header B in intercept bean.Noting Endpoint A and > Endpoint B will be constructed dynamically and will be in multicast as > probably receipient list. > > Can this be done. > > 3)Whats the best way of doing it.I dont want to move away from Spring DSL.I > know i can mix spring DSL and java DSL.DO you guys think i should > dynamically construct routes/Endpoints using java DSL and invoke them in > multicast/recipientList in spring DSL.Rewrite Entire code in java DSL is the > last option. > > Thanks for reading such a long post.Much appreciated.Please let me know if > its confusing. It would be nice if you can answer all three or whichever you > know. > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-receipient-list-with-interceptor-tp5729462.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