Short Description |
Ports |
Metadata |
Sleep Attributes |
Best practices |
See also |
Sleep slows down data records going through it.
Component | Same input metadata | Sorted inputs | Inputs | Outputs | Each to all outputs | Java | CTL | Auto-propagated metadata |
---|---|---|---|---|---|---|---|---|
Sleep | - | 0-1 | 1-n |
Sleep receives data records through its single input port, delays each input record by a specified number of milliseconds and copies each input record to all connected output ports. Total delay does not depend on the number of output ports. It only depends on the number of input records.
The delay can be specified statically by Delay attribute or dynamically based on incoming record content in Input mapping attribute.
Port type | Number | Required | Description | Metadata |
---|---|---|---|---|
Input | 0 | For input data records | Any | |
Output | 0 | For copied data records | Input 0 | |
1-n | For copied data records | Input 0 |
All metadata must be the same.
Metadata can be propagated through this component.
Attribute | Req | Description | Possible values |
---|---|---|---|
Basic | |||
Delay | [1] | Delay of processing each input record; by default in milliseconds, but other time units may be used. Total delay of parsing is equal to the this value multiplicated by the number of input records. | 0-N or time units |
Input mapping | [1] | Delay for input records processing can be also defined dynamically. You can determine how long should be record delayed based on incoming record content. So delay can be dynamically changed by your CTL code. Possible outputs of the mapping are two different values - string value delay, which can be populated by same value as component's attribute Delay, for example '15s'. Second output value delayMillis can specify delay by number of milliseconds. | CTL code |
[1] One of these must be specified. |
When using Sleep, do not forget records are sent out from the component only after its buffer gets full (by default). Sometimes you might need to:
send a record to Sleep
have it delayed by a specified number of seconds
send this very record to output ports immediately
In such case, you have to change settings of the edge outgoing from Sleep to Direct fast propagate. See Types of Edges for more details.
Tip | |
---|---|
An unconnected Sleep component can be used to insert a pause between different phases of a graph. Put an extra phase between the two phases with single unconnected Sleep component. |