Skip to main content

Get

The Get class provides a convenient way to read messages from a kinesis stream.

Extends

This class extends the abstract Action class from Core.

Methods

performAs

public async performAs(actor: Actor): Promise<any>;
  • Description: Gets messages from a kinesis stream.
  • Parameters:
    • actor - The actor performing the action.
  • Returns: Promise<any> - The response object.

recordsFrom

Introduced in: 1.0.0

public static recordsFrom(stream: string, options?: StreamOptions): Get;
  • Description: Create a new instance of the Get class with the specified stream and options.
  • Parameters:
    • stream - stream name or arn (can be controlled via options streamIdentifier).
    • options (optional) - The options object to provide streamIdentifier or partitionKey
  • Returns: Get - A new instance of the Get class.

Usage:

await actor.attemptsTo(
Get.recordsFrom(stream, options),
);

startingAt

Introduced in: 1.0.0

public startingAt(startTime: Date): Get;
  • Description: Sets the start from which the records are read.
  • Parameters:
    • startTime - Date object
  • Returns: Get - The updated instance of the Get class.

Usage:

await actor.attemptsTo(
Get.recordsFrom(stream, options).startingAt(startTime),
);

Methods inherited from Core Action

orSkipOnFail

Introduced in core: 0.5.0

public get orSkipOnFail(): Action;
  • Description: Allows to skip an action on fail.
  • Returns: Action - Returns the current action.

Usage:

// Would skip the step on error without breaking the execution
await actor.attemptsTo(
Do.something().orSkipOnFail,
);

withAbilityAlias

Introduced in core: 0.3.0

public withAbilityAlias(alias: string): Action;
  • Description: Defines the ability alias to be used during execution.
  • Parameters:
    • alias - The alias.
  • Returns: Action - Returns the current action.

Usage:

await actor.attemptsTo(
Do.something().withAbilityAlias('myAlias'),
);