m-bhole
m-bhole

Reputation: 1189

How to generate multiple message from a single message in spring xd?

How to achieve this with spring xd?

Input message : {"key" : "temp", "key1" : "a b c"}

Output messages (my requirement): {"key" : "temp", "key1" : "a"} {"key" : "temp", "key1" : "b"} {"key" : "temp", "key1" : "c"}

[Note:I tried to use splitter but splitter is taking whole payload as input.]

Upvotes: 0

Views: 69

Answers (1)

Gary Russell
Gary Russell

Reputation: 174809

It's probably easiest to create a custom splitter module.

You could do it with a bunch of transformers followed by a splitter and more transformers but it would be rather convoluted...

jsonToMap->save key in a header->transform to key1.payload->split on space
     ->transform back to a map->add key entry back in->mapToJson

Upvotes: 0

Related Questions