I would like to merge the incoming events into one event based on one of the fields.
Input Events:
{
ID: '123',
eventType: 'a',
eventCode: 1
},
{
ID: '123',
eventType: 'b',
eventCode: 2
},
{
ID: '123',
eventType: 'c',
eventCode: 3
}
Expected Output:
{
ID: '123',
events: [{
eventType: 'a',
eventCode: 1
},
{
eventType: 'b',
eventCode: 2
},
{
eventType: 'c',
eventCode: 3
}]
}
I am grouping the events based on a window of 4. So, I need to process the 4 events, merge them and pass it onto the next step.
Use Case: I would like to use the generated output to be stored in MongoDB OR pass it onto an external service.
Is this possible using Siddhi?
NOTE: I see that a similar question has already been asked, but the response is from 5 years ago, and Siddhi has come long way since then.