On Thu, Jun 16, 2011 at 6:53 PM, boday <[email protected]> wrote:
> I think you are looking for the  http://camel.apache.org/scatter-gather.html
> scatter-gather  pattern.  If you use the proper
> http://camel.apache.org/aggregator2.html aggregation strategy
> (completionSize=1, etc), this should work for you...
>
>

You can also just from a java bean send 2x async requests to an
endpoint and grab the first that completes.


> vipup wrote:
>>
>> <pre>
>> I am total newbie in Camel, but hope here I am right ...
>> .. The Camel looks pretty powerfull for my needs, but i don't found any
>> sample, than make something similar. I want perform parallely two or more
>> request into some search engines and get back the only dirst request. Just
>> like the example below have to send back the the winner from 2 searches,
>> where win the first finished search:
>> like
>> Input: "Camel Apache"
>> Process::
>>   1) http://www.google.de/search?q=Camel+Apache
>>   2) http://www.bing.com/search?q=Camel+Apache
>> Output:::
>>   resp1!=null? {1} : {2}
>>
>> Assumes the response have the similar format (xhtml for ex.) and need not
>> to be converted at all. Just for start the pure RAW will be ok.  In
>> another words the looser's answer will be ignored/broken.
>>
>> I just found the sample for Camel+Tomcat, but...
>> ...really it is not so easy to make a fist step! Which EIP is it? Please
>> help! It should be really simple.
>>
>>
>>
>> <camelContext xmlns="http://camel.apache.org/schema/spring";>
>>         <route>
>>
>>             <from uri="servlet:///search"/>
>>             <choice>
>>                 <when>
>>
>>                     <header>search</header>
>>
>>
>>                 </when>
>>                 <otherwise>
>>
>>                     <transform>
>>                         <constant>Add a search to uri, eg
>> ?search=camel</constant>
>>                     </transform>
>>                 </otherwise>
>>             </choice>
>>         </route>
>>     </camelContext>
>>
>>
>> </pre>
>>
>
>
> -----
> Ben O'Day
> IT Consultant -http://consulting-notes.com
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/choose-the-1st-from-two-many-Search-responses-tp4495659p4495883.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to