How I can add a timestamp field if it doesn't exist in JSON stream in spring xd, I think we can use a using groovy script for that.
Suppose my JSON stream is {node : value} I want to add one more field timestamp if it does't exist {node : value, timestamp : 23432434}
stream create example --definition "http | transform --script='file:addTime.groovy'" --deploy
Thanks.
In your script, use a
JsonToObjectTransformerto transform to aLinkedHashMap; thenputthe new map entry if absent, then anObjectToJsonTransformer.