Ask Your Question

Revision history [back]

By design, origins do not produce a no-more-data event if there is no data when the pipeline starts. You can, however, use a script evaluator to detect this condition and produce an event. I used the Jython evaluator, but you could use Groovy or JavaScript if you prefer. Add the evaluator after the origin, and enable 'Produce Events' on its 'General' tab. Connect the event output to your pipeline finisher:

image description

Set the evaluator's init script to initialize state:

state['done'] = False

Now set the evaluator's script to send an event if the first batch it sees is empty

if len(records) == 0 and not state['done']:
  event_record = sdcFunctions.createEvent('no-more-data', 1)
  event_record.value = {'record-count' : 0, 'error-count' : 0, 'file-count' : 0}

state['done'] = True

Now the pipeline will immediately stop if there is no data at startup.