You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by panto <pa...@upstreamsystems.com> on 2015/08/01 11:27:58 UTC

Re: Empty BODY after Aggregation Strategy and convert to String

Code correction:

*Code in my inbound route:*

/from(listeningEndpoint) 
        .streamCaching() 
        .recipientList() 
                .method(router, RecipientListRouter.METHOD_NAME) // Routes
to a list of direct internalEndpoints
                .aggregationStrategy(synchronousAggregationStrategy) 
                .convertBodyTo(String.class) 
        .end() 
.end(); /


*Code in my synchronousAggregationStrategy:*

/if (oldExchange == null) { 
        Object *myBody* = CamelHelper.getMessage(newExchange).getBody());
        CamelHelper.getMessage(newExchange).setBody(myBody, String.class)); 
        return newExchange; 
} /


*Code in each of my outbound routes:*

/from("direct:"+ internalEndpoint) 
        .streamCaching() 
        .to(externalEndpoint)
.end();/


I get the XML response of my outbound HTTP GET request, I see it with
debugger the *CachedOutputStream.WrappedInputStream* body instance and I
cannot unmarshal it to String to return it to my requestor. Any ideas? 



--
View this message in context: http://camel.465427.n5.nabble.com/Empty-BODY-after-Aggregation-Strategy-and-convert-to-String-tp5770184p5770201.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Empty BODY after Aggregation Strategy and convert to String

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you try with latest release. I think we fixed something about
stream caching and agg strategy recently.

On Sat, Aug 1, 2015 at 11:27 AM, panto
<pa...@upstreamsystems.com> wrote:
> Code correction:
>
> *Code in my inbound route:*
>
> /from(listeningEndpoint)
>         .streamCaching()
>         .recipientList()
>                 .method(router, RecipientListRouter.METHOD_NAME) // Routes
> to a list of direct internalEndpoints
>                 .aggregationStrategy(synchronousAggregationStrategy)
>                 .convertBodyTo(String.class)
>         .end()
> .end(); /
>
>
> *Code in my synchronousAggregationStrategy:*
>
> /if (oldExchange == null) {
>         Object *myBody* = CamelHelper.getMessage(newExchange).getBody());
>         CamelHelper.getMessage(newExchange).setBody(myBody, String.class));
>         return newExchange;
> } /
>
>
> *Code in each of my outbound routes:*
>
> /from("direct:"+ internalEndpoint)
>         .streamCaching()
>         .to(externalEndpoint)
> .end();/
>
>
> I get the XML response of my outbound HTTP GET request, I see it with
> debugger the *CachedOutputStream.WrappedInputStream* body instance and I
> cannot unmarshal it to String to return it to my requestor. Any ideas?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Empty-BODY-after-Aggregation-Strategy-and-convert-to-String-tp5770184p5770201.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2