Delayer
Description
This unit is a Processor unit.
A unit that delays input events for a specified amount of time. The delay can be fixed or can depend on a specific input event.
An event enters through the in port. The delay (assigned in the Delay field of the properties) is applied. Once the delay has been applied, the event leaves through the out port.
Configuration
After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:
Tab | Field | Description |
---|---|---|
General | Name | Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed. |
Description | Enter a description detailing the scope of the unit. | |
Language | Specify the language you will use to write the expression in the Delay field, e.g. Javascript, Groovy, etc. | |
Delay | The delay you wish to apply (in milliseconds). Typing a number will apply the same delay to all input events. To apply delays to individual input events, open the expression editor to type an expression stating the input fields and the delay you wish to apply to each. |
Input ports
Port | Description |
---|---|
in | All events enter through this port. |
Output ports
Port | Description |
---|---|
out | All events are output, unchanged, through this port after the delay time. |
Example
In this example, we want to send an HTTP request to the randomuser.me API, which retrieves random user information. We need to send this information by email with a delay of 5 seconds from the moment we ask for the user info. To do it, we add a Tick unit to fire the request every time we need it. Then, we link it to the input port of the Delayer unit and join its output port to an Http call unit, configured with the API information. Finally, we add an Email sink unit to send it to the required recipients.
In the Delayer unit properties, you must specify the delay time required for each event. In this case, we want the same delay for all our events, so we enter the required time in milliseconds (5000).
After saving and starting the Flow, you must click the red button of the Tick unit to begin sending events.
Download this example
You can try this flow by downloading this JSON file and uploading it to your domain using the Import option: