steve-cdl commented on issue #6947:
URL: https://github.com/apache/camel-quarkus/issues/6947#issuecomment-2622173822

   > Yes this is expected when using parallel, then 2 threads can operate at 
the same time on the same body. Saxon is not thread safe so dont do that. Or 
use the onPrepare to make a deep clone of the message body.
   
   The documentation for Split says - 
   
   "Use a Splitter to break out the composite message into a series of 
individual messages, each containing data related to one item."
   
   So my understanding is that when you split, at the start of each split the 
body is now the content of the split.
   So using my earlier example - 
   
   If the input is 
   
   ```
   <Books>
       <Book code="AA"/>
       <Book code="BB"/>
   </Books>
   ```
   
   And I am splitting on Book.
   At the beginning of every split I would expect the body to be the content of 
the split.
   
   For example - 
   
   Split 1 
   body is `<Book code="AA"/>`
   
   Split 2
   body is `<Book code="BB"/>`
   
   However, what I am finding is that if anything changes the body within the 
<split> this is having an affect on other threads.
   
   For example, changing the body to some text - 
   
   ```
   <route streamCache="false">
           <from uri="direct:tokenize-body-main-route"/>
   
   
           <split parallelProcessing="true">
               <tokenize token="Book" xml="true"/>
               <log loggingLevel="INFO" logName="xml" message="body is: 
${body}"/>
               <setBody><simple>I am the body now</simple></setBody>
           </split>
   
       </route>
   ```
   
   And posting a request of 
   
   ```
   <Books>
       <Book code="AA"/>
       <Book code="BB"/>
   </Books>
   ```
   
   gives the following log lines - 
   
   Split 1
   `body is: <Book code="AA"/>`
   
   Split 2
   ```
   body is: <Books>
       <stuff>test</stuff>
       <Book code="AA"/>
       <Book code="BB"/>
   </Books>
   ```
   
   Note - the body of split 2 is the entire request payload and not the 
expected content of the 2nd split (book BB).
   
   Also, reposting the exact same test will result in the expected behaviour
   
   Split 1
   `body is: <Book code="AA"/>`
   
   Split 2
   `body is: <Book code="BB"/>`
   
   However, adding another 'Book' would show the error again.
   But reposting that test, would show the expected the behaviour.
   
   Hopefully this has helped explain it better, if you need more information 
please let me know.
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to