A writer for a Stream.

Note: A StreamWriter cannot be created directly without using the StreamManager.

Hierarchy

  • StreamWriter

Properties

flush: (() => Promise<void>)

Type declaration

    • (): Promise<void>
    • Flush all the inflight events into Pravega Stream. This will ensure all the inflight events are completely persisted on the Pravega Stream.

      Note that write_event(...) and write_event_bytes(...) api send the payload to a background task called reactor to process, so Promise.resolve of these methods only means the payload has been sent to the reactor. If the max_inflight_events is not 0 when creating the writer, there may be some events that are not persisted on the Pravega Stream.

      Returns

      Promise

      Returns Promise<void>

toString: (() => string)

Type declaration

    • (): string
    • Returns string

write_event: ((event: string, routing_key?: string) => Promise<void>)

Type declaration

    • (event: string, routing_key?: string): Promise<void>
    • Write an event into the Pravega Stream. The events that are written will appear in the Stream exactly once. The event of type string is converted into bytes with UTF-8 encoding.

      Note that the implementation provides retry logic to handle connection failures and service host failures. Internal retries will not violate the exactly once semantic so it is better to rely on them than to wrap this with custom retry logic.

      Returns

      Promise

      Parameters

      • event: string

        String that want to be written to the Pravega Stream.

      • Optional routing_key: string

        (optional) The user specified routing key.

      Returns Promise<void>

write_event_bytes: ((buf: Uint8Array, routing_key?: string) => Promise<void>)

Type declaration

    • (buf: Uint8Array, routing_key?: string): Promise<void>
    • Write a byte array into the Pravega Stream. This is similar to write_event(...) api except that the the event to be written is a byte array.

      Note that the implementation provides retry logic to handle connection failures and service host failures. Internal retries will not violate the exactly once semantic so it is better to rely on them than to wrap this with custom retry logic.

      Returns

      Promise

      Parameters

      • buf: Uint8Array

        Byte array that want to be written to the Pravega Stream.

      • Optional routing_key: string

        (optional) The user specified routing key.

      Returns Promise<void>

Generated using TypeDoc