3

I am trying to use SCDF to split and aggregate my list. But I can't aggregate as expected.

My SCDF is being fed by a list over rabbitmq each minute. Let's say i have a list consisting of objects like:

[{"foo" : "11", "bar" : "21"},{"foo" : "11", "bar" : "22"},{"foo" : "12", "bar" : "23"}]

I am splitting the array into the objects in splitter as: app.splitter.expression=#jsonPath(payload,'$.[*]') and it is working as expected.
And in the aggregator, I want to aggregate them based on the value of the property foo, so that the result of aggregation should be two different arrays like:

[{"foo" : "11", "bar" : "21"},{"foo" : "11", "bar" : "22"}]
[{"foo" : "12", "bar" : "23"}]

I set the correlation as: app.aggregator.correlation=#jsonPath(payload,'$.foo') but I dont know how to set release SpEL expression.
Can you show me how should i set release?

PS: As a workaround, I tried to add a last object to the list for detecting it is the end of the list. So, I add {{"foo" : "EoS"} object to the list. And in the release I tried: app.aggregator.release=!messages.?[new String(payload).contains("EoS")].empty but it didn't work.

Selcuk
  • 857
  • 2
  • 11
  • 32
  • here is an example; https://github.com/spring-cloud-stream-app-starters/aggregator/blob/master/spring-cloud-starter-stream-processor-aggregator/src/test/java/org/springframework/cloud/stream/app/aggregator/processor/AggregatorProcessorTests.java – msahin May 04 '20 at 19:50

0 Answers0