Restate Typescript SDK
    Preparing search index...

    Interface ProducerBase<R>Experimental

    Operations shared by Producer and ExactlyOnceProducer.

    A producer owns one ingestion stream. Errors are terminal: once the stream fails, every pending and later operation rejects with the same error, and a new producer is needed.

    interface ProducerBase<R extends Invocation> {
        writable: WritableStream<R>;
        abort(reason?: unknown): void;
        close(): Promise<void>;
        flush(): Promise<number>;
        send(record: R, opts?: SendOptions): Promise<number>;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    Methods

    Properties

    writable: WritableStream<R>

    A WritableStream view of this producer, to pipe a source into it, e.g. with ReadableStream.pipeTo or Node's stream/promises pipeline. Writing sends the record, closing the stream closes the producer and aborting it aborts the producer.

    Methods

    • Experimental

      Sends a record.

      The returned promise resolves with the record offset once the producer has accepted the record into its buffer (or, with bufferBytes: 0, written it to the stream), waiting while the buffer is full. With waitCommitted, it resolves once Restate has durably committed the record instead.

      Always await send: calls that are not awaited keep waiting for buffer space without any bound. Records are sent in call order, so concurrent calls, e.g. with Promise.all, are safe. Note that a record rejected by validation (an oversized record, or a non-increasing exactly-once offset) rejects only its own call, while the others are still sent: with an exactly-once producer, validate records before sending them concurrently, or the commit watermark can move past the rejected offset.

      Parameters

      Returns Promise<number>