Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RStreamsSdk

The main entry point for the RStreams Node SDK. It exposes commonly used functionality in the SDK. Many of these functions come from StreamUtil which also includes more advanced capabilities.

Hierarchy

  • RStreamsSdk

Index

Constructors

Properties

aws: { cloudformation: CloudFormation; dynamodb: LeoDynamodb; s3: S3 }

Type declaration

  • cloudformation: CloudFormation

    A refernce to the AWS CloudFormation library.

  • dynamodb: LeoDynamodb

    Helpful methods for interacting with RStreams' DynamoDB tables.

  • s3: S3

    A refernce to the AWS S3 library.

bot: LeoCron

A library allowing one to manually create, update, checkpoint or retrieve information on a bot.

checkpoint: (config?: ToCheckpointOptions) => TransformStream<unknown, unknown>

Type declaration

configuration: Configuration
destroy: (callback: (err: any) => void) => void

Type declaration

    • (callback: (err: any) => void): void
    • deprecated

      This is a legacy feature that is no longer used that remains for backward compatibility.

      Parameters

      • callback: (err: any) => void
          • (err: any): void
          • Parameters

            • err: any

            Returns void

      Returns void

enrich: <T, U>(opts: EnrichOptions<T, U>, callback: Callback) => void

Type declaration

    • This is a callback-based version of the RStreamsSdk.enrichEvents function.

      It reads events from one queue and writes them to another queue. Put another way, an enrich operation reads events from a source inQueue and then writes them to a destination outQueue, allowing for side effects or transformation in the process.

      The EnrichOptions.transform function is called when events are retrieved from the source queue so you can transform them and send them to the destination queue by calling the callback in the transform function. The callback here as the second argument of this function is meant to be called when all enriching is done on all events (right before it closes down the stream), allowing you to do clean up like closing a DB connection or something.

      Type parameters

      • T

        The type of the data event retrieved from the source queue

      • U

        The type of the data event that is sent to the destination queue

      Parameters

      • opts: EnrichOptions<T, U>

        TThe details of how to enrich and the function that does the work to enrich

      • callback: Callback

        A function called when all events have been processed

      Returns void

enrichEvents: <T, U>(opts: EnrichOptions<T, U>) => Promise<void>

Type declaration

    • This is an async/await friendly version of the RStreamsSdk.enrich function.

      It reads events from one queue and writes them to another queue. Put another way, an enrich operation reads events from a source inQueue and then writes them to a destination outQueue, allowing for side effects or transformation in the process.

      The EnrichOptions.transform function is called when events are retrieved from the source queue so you can transform them and send them to the destination queue by calling the callback in the transform function. The callback here as the second argument of this function is meant to be called when all enriching is done on all events (right before it closes down the stream), allowing you to do clean up like closing a DB connection or something.

      see

      RStreamsSdk.enrich

      Type parameters

      • T

        The type of the event read from the source queue

      • U

        The type of the event that will be written to the destination queue

      Parameters

      • opts: EnrichOptions<T, U>

        The details of how to enrich and the function that does the work to enrich

      Returns Promise<void>

load: <T>(botId: string, outQueue: string, config?: WriteOptions) => WritableStream<Event<T> | T>

Type declaration

    • This creates a pipeline step that acts as the last step of the pipeline, the sink, writing events sent to the pipeline step to the queue specified.

      Type parameters

      • T

        The type of the data received by the pipeline step

      Parameters

      • botId: string

        The bot to act as when writing, events will be marked as written by this bot

      • outQueue: string

        The queue into which events will be written

      • Optional config: WriteOptions

        An object that contains config values that control the flow of events to outQueue

      Returns WritableStream<Event<T> | T>

offload: <T>(config: OffloadOptions<T>, callback: Callback) => void

Type declaration

    • This is a callback-based version of RStreamsSdk.offloadEvents.

      It reads events from a queue to do general processing (such as write to an external DB). It's called offload because it is commonly used to process events and offload them to external resources such as ElasticSearch or other databases that are off of the RStreams Bus.

      It reads from the queue specified in opts and then calls the opts.transform function passing in the events retrieved so they may be processed.

      Type parameters

      • T

        The type of the data read from the RStreams bus queue

      Parameters

      Returns void

offloadEvents: <T>(config: OffloadOptions<T>) => void

Type declaration

    • This is an async/await friendly version of RStreamsSdk.offload.

      It reads events from a queue to do general processing (such as write to an external DB). It's called offload because it is commonly used to process events and offload them to external resources such as ElasticSearch or other databases that are off of the RStreams Bus.

      see

      RStreamsSdk.offload

      Type parameters

      • T

      Parameters

      Returns void

put: <T>(bot_id: string, outQueue: string, payload: T | Event<T>, callback: Callback) => void

Type declaration

    • <T>(bot_id: string, outQueue: string, payload: T | Event<T>, callback: Callback): void
    • A callback-based function to write a single event to an RStreams queue. There are occasions where this is useful, perhaps inside a pipeline step.

      see

      [[RStreamsSdk.putEvents]] An async/await friendly version of this function.

      Type parameters

      • T

        The data to write as the payload of the event

      Parameters

      • bot_id: string

        The name of the bot to write the event as

      • outQueue: string

        The name of the queue to write to

      • payload: T | Event<T>

        The data to write to the queue

      • callback: Callback

        The function to call when done

      Returns void

putEvent: <T>(bot_id: string, outQueue: string, payload: T | Event<T>) => Promise<void>

Type declaration

    • <T>(bot_id: string, outQueue: string, payload: T | Event<T>): Promise<void>
    • An async/await friendly function to write a single event to a queue. There are occasions where this is useful, perhaps inside a pipeline step.

      Type parameters

      • T

        The data to write as the payload of the event

      Parameters

      • bot_id: string

        The name of the bot to write the event as

      • outQueue: string

        The name of the queue to write to

      • payload: T | Event<T>

        The payload of the event to write

      Returns Promise<void>

read: <T>(botId: string, inQueue: string, config?: ReadOptions) => ReadableStream<ReadEvent<T>>

Type declaration

    • Create a pipeline step that reads from the RStreams bus instance queue inQueue doing so as bot botId.

      Type parameters

      • T

        The type of data that will be read from the queue.

      Parameters

      • botId: string

        The bot to read as

      • inQueue: string

        The queue to read from

      • Optional config: ReadOptions

        The options on how to read from this queue

      Returns ReadableStream<ReadEvent<T>>

      The pipeline step that is ready to be used in a pipeline

streams: typeof StreamUtil
returns

Rstreams Used to get the leo stream to do more advanced processing of the streams.

write: <T>(botId: string, config?: WriteOptions) => TransformStream<Event<T>, unknown>

Type declaration

    • Create a pipeline step that takes the events from the previous pipeline step and then writes them to an RStreams bus queeu.

      Type parameters

      • T

      Parameters

      • botId: string

        The bot to act as when writing.

      • Optional config: WriteOptions

        Options for writing

      Returns TransformStream<Event<T>, unknown>

      The pipeline step that is ready to be used in a pipeline

Generated using TypeDoc