On Tue, Apr 24, 2012 at 2:43 AM, Jason Burkhardt <jburkha...@gmail.com> wrote: > Hi Claus, > Thanks for pointing me in the proper direction. > In most cases I want the http server to remain multithreaded, but in this > specific case I really need the messages in order so out of your ideas I > figured the most appropriate would be to limit the individual route using > the threads dsl. > I changed my route to: > <route> > <from uri="httpserver:myserver?someoptions"/> > <threads poolSize="1" maxPoolSize="1"> > <log message="message ${body}"/> > </threads> > </route> > > But I will still occasionally log messages out of order (generally happens > if one is much larger than a following one, eg 358kb message followed by a > 0.5kb message, the 0.5kb message is logged first sometimes). They're all > still logged in the proper order inside the http component, just like > before, but once I call processor.process on my newly created exchange I > lose the order. > > Did I miss the spirit of your post or am I using the threads dsl improperly? >
Well the thread pool should process the messages in the order the message is handed over to the thread pool. But since your http server is multi threaded there is no guarantee that what you see incoming in the http server is the same order that is being handed over to the thread pool in Camel. The JVM controls the threading and it may change CPU processing of threads in between what you see incoming at HTTP server and what gets send to the thread pool. If you can control the threading model of the http server you can possible configure it to use a single worker thread. And then queue up incoming requests internally. Where the worker thread is the thread that Camel uses, and thus it would become sequential. An alternative is that if the incoming requests have some sort of data that can be used to re-sequence the messages. Then you can use the resequencer EIP. > -- > View this message in context: > http://camel.465427.n5.nabble.com/custom-component-synchronous-processing-tp5652471p5660809.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/