Skip to main content

Put

The Put class provides a convenient way to put messages on a kinesis stream.

Extends

This class extends the abstract Action class from Core.

Methods

performAs

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

recordTo

Introduced in: 1.0.0

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

Usage:

await actor.attemptsTo(
Put.recordTo(data, stream, options),
);

recordsTo

Introduced in: 1.0.0

public static recordsTo(data: any[], stream: string, options?: StreamOptions): Put;
  • Description: Create a new instance of the Put class with the specified data array, stream and options.
  • Parameters:
    • data - the data array to be sent as messages to the stream
    • stream - stream name or arn (can be controlled via options streamIdentifier).
    • options (optional) - The options object to provide streamIdentifier or partitionKey
  • Returns: Put - A new instance of the Put class.

Usage:

await actor.attemptsTo(
Put.recordsTo(data, stream, options),
);

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'),
);