Hi Claus ,
Yes Jsonpath is correct
The following java DSL code is working fine as expected
@Component
public class DataRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file:C:\\Users\\sahil\\Desktop\\Source")
.split().jsonpath("$")
.aggregate(constant(true), new
GroupedBodyAggregationStrategy())
.completionSize(10)
.completionTimeout(1000)
.marshal().json(JsonLibrary.Jackson)
.log("${body}")
.to("file:C:\\Users\\sahil\\Desktop\\Source");
}
}
It is successfully splitting in batches of 10.
But I am facing issue with xml dsl that it not considering completionSize
attribute.
Can you please suggest on this.
Regards
Sahil
On Sat, May 20, 2023 at 1:44 PM Claus Ibsen <[email protected]> wrote:
> Hi
>
> Are you sure jsonpath $ will return a list or something that can be
> iterated for the splitter to turn into 10 elements.
> As you have timeout 1s then it may be that this is what causes the output
> of the trigger.
>
> Make sure you jsonpath is correct, there are online jsonpath validators you
> can try with your json sample input
>
> On Fri, May 19, 2023 at 11:55 PM Sahil Upneja <[email protected]> wrote:
>
> > Hi Team,
> >
> > I am not able to use aggregate with Splitter in Camel Version 3.20.0.
> >
> > *completionSize* is not getting considered when I am using Aggregate
> inside
> > the Splitter
> >
> > Splitter is splitting in batches of 1 only, but I want to split Json
> array
> > of large size say 100 into batches of 10.
> >
> > Below is my code snippet
> >
> >
> > <bean id="myStrategy"
> >
> >
> class="org.apache.camel.processor.aggregate.GroupedBodyAggregationStrategy"/>
> >
> >
> > <route>
> > < from uri : splitter>
> > <split>
> > <jsonpath>$</jsonpath>
> > <aggregate aggregationStrategy= "myStrategy"
> > *completionSize="10"* completionTimeout="1000">
> > <correlationExpression>
> > <constant>true</constant>
> > </correlationExpression>
> > <marshal>
> > <json></json>
> > </marshal>
> > </aggregate
> > </split>
> > < to uri : transformer>
> > </route>
> >
> >
> > Can you please suggest how to achieve this.
> >
> > Thanks & Regards
> >
> > Sahil
> >
>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>