camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Rutherford <>
Subject Re: trying to implement rendezvous
Date Wed, 11 Mar 2009 09:55:04 GMT
With this approach:

from("direct:submsg").split().parallelProcessing().to(client socket).end();

How does the threading work?

Will a new thread be spawned for each new request into the tcp
endpoint and will that thread then spawn a new thread for each
submessage @ the parallelprocessing() part and will each of those
threads block while waiting for a response from the client socket?

So for example, if 10 requests came in at the same second:

- 10 threads will be spawned to process the route
- each message has 5 service messages and so each processing thread
will now spawn 5 more threads to process the service messages
- all these threads will block while waiting for a response or socket
timeout (timeout for client socket is 30 sec)



On 11/03/2009, Claus Ibsen <> wrote:

> Since the control message is the key, you should wait with the
>  splitting until the control message has been submitted and processed
>  succesful.
>  // an exception catcher to return a failed MSG to the TCP (*)
>  onException(MyProcessException.class).handled(true).process(setFailedResponseMsg);
>  // and then set a failed msg in the OUT body
>  // a simple route for the control.
>  from(tcp).process(controlMessage).to("direct:submsg");
>  // and the splitter has a build in aggregator, so we can do it
>  something like this
>  // See more at:, there is a
>  sample at the bottom at split, aggregate and return a combined
>  response
>  from(direct:submsg).split(xpath stuff, aggregation
>  strategy).parallelProcessing().to(processEachLine).end();
>  Ad *
>  You can use tryBlock(), handle() instead as a kind of try .. catch
>  code as well. But then you can not do multiple routes (eg multiple
>  from)
>  So its something like this.
>  tryBlock();
>   from(tcp).process(controlMessage).
>   .split(xpath stuff, aggregation
>  strategy).parallelProcessing().to(processEachLine).end();
>  .handle(Exception.class)
>   .process(setFailedResponseMsg);
>  .end();
>  Note I wrote this directly in gmail, so no code completion and you
>  might need to fiddle with it to get the syntax correct and it to work.

View raw message