Thanks Stephen.

I followed your sample snippet below.

The wiretap was a success, however, I couldnt get through with the
aggregator.

It kept complaining class not found for my custom aggregator. See sample
snippet below:

  <osgi:camelContext xmlns="http://camel.apache.org/schema/spring";
trace="true">
  
   <package>org.tempuri</package>
  
    <route>
        <from uri="nmr:RequestProcessor" />
        <wireTap uri="direct:ProcessorServices"/>       
        <!-- <to uri="log:TerminalManagerRequest"/>-->
        <to
uri="nmr:{http://services.locator/}ServicesService:ServicesPort"/>
        <to uri="direct:ProcessorServices"/>
    </route>
    
    <route>
        <from uri="direct:ProcessorServices" />
        <aggregate strategyRef="myAggregatorStrategy" batchSize="2"> 
                <correlationExpression>
                        <constant>true</constant>
                    </correlationExpression>            
                <to uri="log:Response"/>
            </aggregate>
    </route>
    
  </osgi:camelContext>
  
  <bean id="myAggregatorStrategy"
class="org.tempuri.MyAggregationStrategy"/>
  
</beans>



I have the ffg in my project 

src/main/java/org/tempuri/MyAggregationStrategy.java
src/main/resources/META-INF/spring/camel-context.xml

And I can confirm the class is compiled with the bundle deployed.

Any ideas?




Stephen Gargan wrote:
> 
> Hi,
> 
> You can use Wiretaps and an aggregator to do what you're suggesting.
> At each step that you want an intermediate result to be available,
> wiretap it off to an aggregator and set the batch size of the
> aggregator accordingly.
> 
> from("direct:consumerEndpoint").wireTap("direct:aggregator").to("direct:requestToSomeEndpointTransformer").to(
>                     "direct:someEndpoint").to("direct:aggregator");
> 
> from("direct:aggregator").aggregate().header("id").batchSize(2).groupExchanges().to("mock:result");
> 
> One thing to note is that groupExchanges() will gather up all the
> aggregated exchanges and store them in a property in the exchange. You
> get at them via
> 
> List<Exchange> grouped = e.getProperty(Exchange.GROUPED_EXCHANGE,
> List.class);
> 
> You'll need to write a custom processor (in place of the mock) to
> combine/transform them to your liking as before responding. You can
> find a bunch of info about aggregators here
> 
> http://camel.apache.org/aggregator.html
> 
> ste.
> 
> On Thu, Jan 14, 2010 at 12:12 AM, lekkie <[email protected]> wrote:
>>
>> Hi guys,
>>
>>
>> Just a quick one. I have this scenario where I 'd like to manipulate a
>> request and some reponse from an endpoint. The flow below describe what I
>> am
>> trying to achieve:
>>
>> <osgi:camelContext xmlns="http://camel.apache.org/schema/spring";
>> trace="true">
>>    <route>
>>      <from uri="nmr:consumerEndpoint"/>
>>      <to uri="xslt:requestToSomeEndpoint.xsl"/>
>>      <to uri="nmr:someEndpoint"/>
>>      <to uri="xslt:requestToAnotherEndpoint.xsl"/>
>>      <to uri="nmr:anotherEndpoint"/>
>>    </route>
>> </camelcontext>
>>
>> I'd like the transformation (requestToAnotherEndpoint.xsl) to be able to
>> access/manipulate the original request message from nmr:consumerEndpoint
>> and
>> the response from nmr:someEndpoint in order to product its output.
>>
>> Is this scenario possible?
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27157259.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27178135.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to