cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop snap execution

kokimura
New Contributor

I have a pipeline which along the way checks for a presence of a particular value. If there is no value it should exit without errors but not execute the the rest of the pipelines. How do I achive that?
For example:

  1. MySQL Snap reads a value from somewhere → 2. MySQL Snap uses the value and writes it to another table
    Imagine that the first snap’s read returns null i.e. there is not value. How can I check that and make the pipeline stop without an error and not execute the second snap?
    I tried with Filter and Router but that did not work.
    I tried with Router and Exit but the Exit throws an error and does not stop the second snap from executing either.
    Thanks!
1 ACCEPTED SOLUTION

dimitri_hristov
Contributor

Hi @kokimura,

Perhaps you could use the object.hasPath(field) function to check for the existence of a field in a Filter Snap, in order to stop the invalid documents from propagating further down the pipeline and cause errors in the downstream snaps.

BR,
Dimitri

View solution in original post

2 REPLIES 2

dimitri_hristov
Contributor

Hi @kokimura,

Perhaps you could use the object.hasPath(field) function to check for the existence of a field in a Filter Snap, in order to stop the invalid documents from propagating further down the pipeline and cause errors in the downstream snaps.

BR,
Dimitri

kokimura
New Contributor

Dmitri, that worked. Thank you!