Redelivery of message in case of exception inside aggregator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Redelivery of message in case of exception inside aggregator

codentravel
Hi,

In my aggregationstratgy route, sometimes (1 out of 10000) i get message body as null in the newExchange.. I have no clue whats wrong.

Thought of trying the retry with default error handler. But Aggregator doesn't support throwing an exception. Is there any alternative to aggregator ?

 restConfiguration().component("restlet")
                    .componentProperty("maxQueued", "-1")
                    .componentProperty("persistingConnections", "true")
                    .componentProperty("pipeliningConnections", "true")
                    .host("localhost").port(Constants.ROUTINGPORT).bindingMode(RestBindingMode.off);

            rest("api/v1").
                    post("/collector").
                    consumes("application/octet-stream").
                    route().routeId("Collector Inlet").
                    to("seda:aggregate?waitForTaskToComplete=Never");

            from("seda:aggregate").
                    routeId("Message Aggregation").
                    setHeader("id", constant("n/a")).              
                    aggregate(header("id"), new MessageAggregation()).
                    completionSize(Constants.BATCHSIZE).
                    to("seda:process?waitForTaskToComplete=Never");
Reply | Threaded
Open this post in threaded view
|

Re: Redelivery of message in case of exception inside aggregator

Claus Ibsen-2
It can be because the message body from REST is streaming based
http://camel.apache.org/why-is-my-message-body-empty.html

And also you send to seda and don't wait, hence the REST consumer may
close the stream before the aggregator is aggregating the newExchange.

So you should likely convert the message to a non stream to be more
safe such as byte[] or String before routing to seda



On Tue, May 16, 2017 at 7:08 AM, codentravel <[hidden email]> wrote:

> Hi,
>
> In my aggregationstratgy route, sometimes (1 out of 10000) i get message
> body as null in the newExchange.. I have no clue whats wrong.
>
> Thought of trying the retry with default error handler. But Aggregator
> doesn't support throwing an exception. Is there any alternative to
> aggregator ?
>
>  restConfiguration().component("restlet")
>                     .componentProperty("maxQueued", "-1")
>                     .componentProperty("persistingConnections", "true")
>                     .componentProperty("pipeliningConnections", "true")
>
> .host("localhost").port(Constants.ROUTINGPORT).bindingMode(RestBindingMode.off);
>
>             rest("api/v1").
>                     post("/collector").
>                     consumes("application/octet-stream").
>                     route().routeId("Collector Inlet").
>                     to("seda:aggregate?waitForTaskToComplete=Never");
>
>             from("seda:aggregate").
>                     routeId("Message Aggregation").
>                     setHeader("id", constant("n/a")).
>                     aggregate(header("id"), new MessageAggregation()).
>                     completionSize(Constants.BATCHSIZE).
>                     to("seda:process?waitForTaskToComplete=Never");
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Redelivery-of-message-in-case-of-exception-inside-aggregator-tp5799551.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Redelivery of message in case of exception inside aggregator

codentravel
Thanks for the reply.
I did exactly the same yesterday.. It seem to be working fine..

Do you have any suggestion bring the CPU down ?
 Currently it consumes about 70% of CPU (beaglebone with 1gb of RAM) for 15 messages/second.  Is it normal for Camel to consume so much of CPU ?
Reply | Threaded
Open this post in threaded view
|

Re: Redelivery of message in case of exception inside aggregator

Claus Ibsen-2
I suggest to use a profiler to see what is going on in your JVM.

You may need to tweak restlet accordingly to your needs. You can set
limits on thread pools and whatnot.

And maybe also the load on the JVM if you have a lot of messages queued up etc.

Camel has little overhead, so its often other things you need to tweak.
However as you use SEDA with an unbounded queue you can end up with
too many messages pending, if you take in more messages than you can
process.


On Wed, May 17, 2017 at 1:39 PM, codentravel <[hidden email]> wrote:

> Thanks for the reply.
> I did exactly the same yesterday.. It seem to be working fine..
>
> Do you have any suggestion bring the CPU down ?
>  Currently it consumes about 70% of CPU (beaglebone with 1gb of RAM) for 15
> messages/second.  Is it normal for Camel to consume so much of CPU ?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Redelivery-of-message-in-case-of-exception-inside-aggregator-tp5799551p5799704.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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