Transforming
You can write logic in your Cloud Action to perform a transformation on the event
received, and then create one or more new events with different payloads. This is accomplished by dynamically constructing and returning an event handler within Action Runner. For example, the following code modifies the x
field of event
and then forwards a new event:
function(event) {
// Your code here
var new_event = event;
new_event.elems.x += 1;
return {
"/my_company/transformed": [new_event],
"/my_company/original": [event]
}
}
In this example, /my_company/transformed
is the path that the new event is output to. The original event is also output into a /my_company/original
stream.
Updated about 5 years ago