Interface Reporter
interface Reporter {
receiveGlobalMetadata?(
key: string,
value: PlainValue,
): void | Promise<void>;
report(event: Event): void | Promise<void>;
}
receiveGlobalMetadata?(
key: string,
value: PlainValue,
): void | Promise<void>;
report(event: Event): void | Promise<void>;
}
Implemented by
Methods
Optionalreceive Global Metadata
-
Receives one entry of the journey's global metadata: a key, and a value captured when it was set. The journey ID comes first, under
journey_id; setting a key again replaces its value. A reporter without this operation accepts every entry and does nothing with it.Parameters
- key: string
- value: PlainValue
Returns void | Promise<void>
Receives the events and the global metadata of a journey, and decides on its own what to do with each: filter it, map it, forward it, keep it or ignore it. A workflow lists its reporters, and a workflow instance may add more; itinera builds them for every journey.
Either operation may be synchronous or asynchronous: itinera waits for what it returns before it goes on, so a slow reporter slows the journey.
A reporter handles its own trouble. One that cannot report an event should deal with that itself, by logging it, dropping the event or keeping it to retry later, and return normally, so that the reporters after it still receive the event. A failure that escapes a reporter, a throw or a rejected promise, aborts the journey with
reporter failed, and the event goes no further.