Delay
The Delay middleware allows to insert a user-defined delay between 2 middlewares. This can either allow to insert a fixed delay between processing of documents, or resume the processing of a pipeline at a given arbitrary time.
⏰ Delaying Processing
To use this middleware, you import it in your CDK stack and instantiate it as part of a pipeline.
💁 In this example, we specify a fixed duration to the
.withTime
method, during which the Delay middleware will wait before passing the document to the next middleware in the pipeline.
Using Date Objects
It is also possible to specify an arbitrary Date
object to the .withTime
method, specifying when to resume the processing of a pipeline.
🏗️ Architecture
The Delay middleware uses AWS Step Functions to orchestrate the delay using a state machine. The Step Function is configured to wait for a given duration before passing the document to the next middleware in the pipeline.
🏷️ Properties
Supported Inputs
Mime Type | Description |
---|---|
*/* | The delay middleware can consume any type of document. |
Supported Outputs
Mime Type | Description |
---|---|
*/* | The delay middleware can produce any type of document. |
Supported Compute Types
Type | Description |
---|---|
CPU | This middleware only supports CPU compute. |
📖 Examples
- Delay Pipeline - An example showcasing how to delay a pipeline execution.