In this article
You can use this Snap to consolidate all documents from upstream Snaps into a single output document. Based on the Snap's configuration, each input stream displays the count of documents, all records, first record or the final record.
This Snap does not complete executing until the execution of all upstream Snaps is done. |
Unless the Ignore empty stream checkbox is selected, the Gate Snap always produces an output document, regardless of how many or if no input documents are received. In some Pipeline designs, this functionality can trigger an error message stating, mapped variables are missing, during validation. This error typically occurs when a downstream Snap expects a field based off an output document from the Gate Snap that is empty. To prevent the error from occurring, you can limit empty documents produced by the Gate Snap by inserting a Filter Snap after it with the following expression in the Filter Expression
When you run the Pipeline after adding the Filter Snap with this expression, the Pipeline validates and executes successfully, and the error no longer occurs. |
If large amounts of data are required for your output, offload your data prior to Snap execution, and write the data to a file or database. Upon the completion of Snap execution, you can use a Reader Snap (such as File Reader and S3 Reader) to read from the offloaded data source.
Input/Output | Type of View | Number of Views | Examples of Compatible Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| One or more documents containing records that must be passed on to downstream Snaps for further processing. |
Output | Document |
|
| A single document that contains all the records received from the various upstream Snaps. |
Field Name | Field Type | Description | |
---|---|---|---|
Label | String | Specify a name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline. Default Value: Gate | |
Ignore empty stream | Checkbox | Select this checkbox to enable the Snap to ignore empty streams received at the input view during Pipeline execution. In such a case, the Snap does not produce any output document; else, the Snap writes an empty array to the output document. Default Value: Deselected | |
Output Document Content | Dropdown list | Choose an option to indicate the document count and the specific document to include in the output. This option helps avoid excessive memory consumption. The available options are:
For more information, see this example. Default Value: All input documents | |
Snap Execution | N/A | Select one of the three modes in which the Snap executes. Available options are:
Default Value: Validate & Execute |
This example demonstrates how you can use the Gate Snap to combine the complete output of multiple upstream Snaps into a single document. This example also shows how the Gate Snap does not offer any output until all upstream Snaps have completed executing.
You create a separate branch of the Pipeline by adding an unconnected REST Get Snap. You configure the Snap to retrieve contact data from HubSpot, which typically offers data in pages of 20 records each. You use the Has next and Next URL fields to specify how the Snap can retrieve additional pages of data. For step-by-step information on how to use the REST Get Snap to perform this task, see Retrieving Contact Information from HubSpot.
The REST Get Snap retrieves the data in pages of 20 as requested until the value of the has-more
variable changes to false:
Note that until the REST Snap completes executing, the Gate Snap doesn't start reading data from any of its input views. |
This example Pipeline demonstrates the following three methods in which to collect the output document content from the upstream Snaps using the Gate Snap.
Document count and first document for each input
Document count and final document for each input
We build three Pipelines to pass data using two Mapper Snaps and empty data from the JSON Generator Snap.
We connect the Gate Snap to the upstream Snaps. We configure the Gate Snap in each Pipeline with each of the options under Output Document Content field as highlighted in the screenshots below. Upon validation, the Snaps yield the respective outputs based on the configuration.