Sure, here is the route:

from("jms:queue:csv-request?maxConcurrentConsumers=1")
   .transacted("propagationRequired")
   .process(uriToFileProcessor)
   .split().tokenize("\n",
1).streaming().parallelProcessing().stopOnException().shareUnitOfWork()
      .choice().when(simple("${property.CamelSplitIndex} > 1"))
         .log(LoggingLevel.DEBUG, "Creating order with: ${body}")
         .to("bean:orderManager?method=createOrder")
         .log(LoggingLevel.DEBUG, "queuing order on prepare-order: ${body}")
         .inOnly("jms:queue:prepare-order").endChoice()
      .otherwise().log(LoggingLevel.DEBUG, "Header: ${body}").endChoice()
      .end() // ends choice
   .end(); // ends split

In a separate route builder, I have:
from("jms:queue:prepare-order?maxConcurrentConsumers=20")
   .transacted("propagationRequired")
   .log(LoggingLevel.DEBUG, "Preparing order: ${body}")
   .to("bean:orderManager?method=prepare");

This isn't a copy/paste of the route, but I've brought over all the
important bits.  I've removed some validation and logging calls, removed
onException calls, replaced constants with strings, etc.  I tried to trim it
down to the essentials.

The transaction policy "propagationRequired" is needed because the app has
more than one PlatformTransactionManager.

URIs of CSV files are sent to the csv-request queue.  These CSV files can
have thousands of lines in them.  If parallelProcessing is
removed/commented/disabled, the logging will show the statements for
creating and queuing the order, but the prepare-order route's logging won't
start showing up until the entire file has been split.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Unexpected-behavior-with-splitter-tp5747564p5747578.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to