Restate Typescript SDK
    Preparing search index...

    Type Alias ServiceHandlerOpts<I, O>

    type ServiceHandlerOpts<I, O> = {
        abortTimeout?: Duration | number;
        accept?: string;
        description?: string;
        idempotencyRetention?: Duration | number;
        inactivityTimeout?: Duration | number;
        ingressPrivate?: boolean;
        input?: Serde<I>;
        journalRetention?: Duration | number;
        metadata?: Record<string, string>;
        output?: Serde<O>;
        retryPolicy?: RetryPolicy;
    }

    Type Parameters

    • I
    • O
    Index

    Properties

    abortTimeout?: Duration | number

    Guards against invocations that fail to terminate after inactivity. The abort timeout starts after inactivityTimeout expires and a graceful termination was requested. When this timer expires, the invocation is aborted.

    This timer may interrupt user code. If more time is needed for graceful termination, increase this value.

    Overrides the abort timeout set at the service level and the default configured in the Restate server.

    Note: Available only when registering this endpoint with restate-server v1.4 or newer; otherwise service discovery will fail.

    accept?: string

    Defines which Content-Type values are accepted when this handler is invoked via the ingress. Wildcards are supported, for example application/* or * / *.

    If unset, input.contentType will be used as the default.

    This setting does not affect deserialization. To customize how the input is deserialized, provide an input Serde.

    description?: string

    Human-readable description of the handler, shown in documentation/admin tools.

    idempotencyRetention?: Duration | number

    The retention duration of idempotent requests to this handler.

    Note: Available only when registering this endpoint with restate-server v1.4 or newer; otherwise service discovery will fail.

    inactivityTimeout?: Duration | number

    Guards against stalled invocations. Once this timeout expires, Restate requests a graceful suspension of the invocation (preserving intermediate progress).

    If the invocation does not react to the suspension request, abortTimeout is used to abort it.

    Overrides the inactivity timeout set at the service level and the default configured in the Restate server.

    Note: Available only when registering this endpoint with restate-server v1.4 or newer; otherwise service discovery will fail.

    ingressPrivate?: boolean

    When set to true, this handler cannot be invoked via the Restate server HTTP or Kafka ingress; it can only be called from other services.

    Note: Available only when registering this endpoint with restate-server v1.4 or newer; otherwise service discovery will fail.

    input?: Serde<I>

    Serde used to deserialize the input parameter. Defaults to restate.serde.json.

    Provide a custom Serde if the input is not JSON, or use restate.serde.binary to skip serialization/deserialization altogether; in that case the input parameter is a Uint8Array.

    journalRetention?: Duration | number

    The journal retention for invocations to this handler.

    When a request has an idempotency key, idempotencyRetention caps the journal retention time.

    Note: Available only when registering this endpoint with restate-server v1.4 or newer; otherwise service discovery will fail.

    metadata?: Record<string, string>

    Arbitrary key/value metadata for the handler. Exposed via the Admin API.

    output?: Serde<O>

    Serde used to serialize the output value. Defaults to restate.serde.json.

    Provide a custom Serde if the output is not JSON, or use restate.serde.binary to skip serialization/deserialization altogether; in that case the output value is a Uint8Array.

    retryPolicy?: RetryPolicy

    Retry policy to apply to all requests to this handler. For each unspecified field, the default value configured in the service or, if absent, in the restate-server configuration file, will be applied instead.