Event Generation

You can use the JavaScript Scripting origin to generate event records for an event stream. Enable event generation when you want the stage to generate an event record based on scripting logic.

As with any record, you can pass event records downstream to a destination for event storage or to any executor that can be configured to use the event. For more information about events and the event framework, see Dataflow Triggers Overview.

To generate events:
  1. On the General tab, select the Produce Events property.

    This enables the event output stream for use.

  2. Include both of the following methods in the script:
    • sdc.createEvent(<String type>, <Integer version>) - Creates an event record with the specified event type and version number. You can create a new event type or use an existing event type. Existing event types are documented in other event-generating stages.

      The event record contains no record fields. Generate record fields as needed.

    • batch.toEvent(<record>) - Use to append an event record to a batch and pass events to the event output stream.