[ 
https://issues.apache.org/jira/browse/CAMEL-23281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Spampinato updated CAMEL-23281:
-----------------------------------------
    Description: 
Hi, 

i've a simple integration scenario.

A csv file is polled from file system, the file is splitted and divided in 
chunks of certain size.

Every chunk is persisted in bulk mode into a database, after that the file is 
moved into a processed folder. The entire file processing must be in 
transaction.
{code:java}
from(file("data").move("done"))
  .transacted()
  .split(body().tokenize(CSV_NEW_LINE)).streaming().stopOnException()
  .choice()
  .when(exchangeProperty(SPLIT_INDEX).isGreaterThan(0))
    .unmarshal().bindy(BindyType.Csv, CsvData.class)
    .aggregate(constant(true), AggregationStrategies.groupedBody())
    .eagerCheckCompletion()
    .executorService(new SynchronousExecutorService())
    .completionSize(BULK_SIZE)     
    .completionPredicate(exchangeProperty(SPLIT_COMPLETE))
    .to(direct("saveData"));

from(direct("saveData"))
  .log("${body}")
  .to(jpa("java.util.List").usePersist(true).flushOnSend(true)); {code}
With version 4.18.0 everything works fine. With batch size of 5 and a csv of 11 
lines, 3 batch created and persisted to db in a single database tx.

With version 4.18.1, after the creation of first chunk the aggregator remains 
stuck and no progression is made

!image-2026-04-02-00-55-36-946.png!

The csv is not moved into processed folder and i've to kill the application.

I've created a small repo to reproduce the issue.

[spampibridge/split-aggregate|https://github.com/spampibridge/split-aggregate]

  was:
Hi, 

i've a simple integration scenario.

A csv file is polled from file system, the file is splitted and divided in 
chunks of certain size.

Every chunk is persisted in bulk mode into a database, after that the file is 
moved into a processed folder. The entire file processing must be in 
transaction.
{code:java}
from(file("data").move("done"))
  .transacted()
  .split(body().tokenize(CSV_NEW_LINE)).streaming().stopOnException()
  .choice()
  .when(simple(SKIP_HDR_EXPRESSION))
    .unmarshal("dataFormat")
    .aggregate(constant(true), AggregationStrategies.groupedBody())
    .eagerCheckCompletion()
    .executorService(new SynchronousExecutorService())
    .completionSize(BULK_SIZE)
    .completionPredicate(simple(SPLIT_END_EXPRESSION))
    .to(direct("logData"));

from(direct("logData"))
  .log("${body}")
  .to(jpa("java.util.List").usePersist(true).flushOnSend(true)); {code}
With version 4.18.0 everything works fine. With batch size of 5 and a csv of 11 
lines, 3 batch created and persisted to db in a single database tx.

With version 4.18.1, after the creation of first chunk the aggregator remains 
stuck and no progression is made

!image-2026-04-02-00-55-36-946.png!

The csv is not moved into processed folder and i've to kill the application.

I've created a small repo to reproduce the issue.

[spampibridge/split-aggregate|https://github.com/spampibridge/split-aggregate]


> [camel-core] split/aggregator stuck in tx
> -----------------------------------------
>
>                 Key: CAMEL-23281
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23281
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 4.18.1
>            Reporter: Francesco Spampinato
>            Priority: Minor
>         Attachments: image-2026-04-02-00-55-36-946.png
>
>
> Hi, 
> i've a simple integration scenario.
> A csv file is polled from file system, the file is splitted and divided in 
> chunks of certain size.
> Every chunk is persisted in bulk mode into a database, after that the file is 
> moved into a processed folder. The entire file processing must be in 
> transaction.
> {code:java}
> from(file("data").move("done"))
>   .transacted()
>   .split(body().tokenize(CSV_NEW_LINE)).streaming().stopOnException()
>   .choice()
>   .when(exchangeProperty(SPLIT_INDEX).isGreaterThan(0))
>     .unmarshal().bindy(BindyType.Csv, CsvData.class)
>     .aggregate(constant(true), AggregationStrategies.groupedBody())
>     .eagerCheckCompletion()
>     .executorService(new SynchronousExecutorService())
>     .completionSize(BULK_SIZE)     
>     .completionPredicate(exchangeProperty(SPLIT_COMPLETE))
>     .to(direct("saveData"));
> from(direct("saveData"))
>   .log("${body}")
>   .to(jpa("java.util.List").usePersist(true).flushOnSend(true)); {code}
> With version 4.18.0 everything works fine. With batch size of 5 and a csv of 
> 11 lines, 3 batch created and persisted to db in a single database tx.
> With version 4.18.1, after the creation of first chunk the aggregator remains 
> stuck and no progression is made
> !image-2026-04-02-00-55-36-946.png!
> The csv is not moved into processed folder and i've to kill the application.
> I've created a small repo to reproduce the issue.
> [spampibridge/split-aggregate|https://github.com/spampibridge/split-aggregate]



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

Reply via email to