Claus Ibsen created CAMEL-22259:
-----------------------------------

             Summary: camel-core - Splitter with shareUnitOfWork should use 
single uow
                 Key: CAMEL-22259
                 URL: https://issues.apache.org/jira/browse/CAMEL-22259
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
    Affects Versions: 4.13.0
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.14.0


A bit related to

[https://camel.zulipchat.com/#narrow/channel/257298-camel/topic/Camel.20Kafka.20Producer.20throws.20Exception.20in.20loop.2Fsplit/with/530123024]

 

The shareUnitOfWork feature is unfortunately not a good solution but was needed 
at the time to deal with failures after a split and access to the caused 
exception from the splitting. Using UoW in this solution was maybe in hindsight 
not as good, and today its a bit of problem.

The splitter uses child UoW that has the shared uow as parent, but each child 
is independent despite the name of the option would imply its all a single 
shared UoW.

We can refactor the code to make it truly shared as the documentation and name 
of the option suggests. 

The existing functionality keeps working. However this change means the done 
work for each split UoW will be triggered when the parent ends at the end, so 
if 1000 sub messages in split has some UoW then those 1000 tasks are executed 
at the very end.

According to the doc this is what you would expect. However it may have some 
implications as when those 1000 sub tasks are executed then they may no longer 
have access to a local resource such as a network connection. For example a FTP 
client that needs to delete a file after processing. So share unit of work is 
not "thread safe" to be used in 100% situations. 

We may consider also deprecating this feature and come up with another solution 
for the original problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to