Options
All
  • Public
  • Public/Protected
  • All
Menu

A return type to allow returning forwards or failures, and attaching effects to messages.

Type Parameters

  • Message = any

    the type of the reply message

Hierarchy

  • Reply

Index

Constructors

Methods

  • message<Message>(message: Message, metadata?: Metadata): Reply<Message>
  • Create a message reply.

    Type Parameters

    • Message

      the type of the reply message

    Parameters

    • message: Message

      the message to reply with

    • Optional metadata: Metadata

      optional metadata to pass with the reply

    Returns Reply<Message>

    a message reply

  • Create a forward reply.

    Type Parameters

    • Message

      the type of the reply message

    Parameters

    • method: EffectMethod

      the service call representing the forward

    • message: any

      the message to forward

    • Optional metadata: Metadata

      optional metadata to pass with the forwarded message

    Returns Reply<Message>

    a forward reply

  • Create a failure reply.

    Type Parameters

    • Message

      the type of the reply message

    Parameters

    • description: string

      description of the failure

    • Optional status: GrpcStatus

      the GRPC status, defaults to Unknown

    Returns Reply<Message>

    a failure reply

  • empty<Message>(): Reply<Message>
  • Create a reply that contains neither a message nor a forward nor a failure.

    This may be useful for emitting effects while sending an empty message.

    Type Parameters

    • Message

      the type of the reply message

    Returns Reply<Message>

    an empty reply

  • Set the protobuf service method for a forwarding reply.

    Parameters

    Returns Reply<Message>

    the updated reply

  • getMessage(): undefined | Message
  • setMessage(message: Message): Reply<Message>
  • Set the message for this reply.

    Parameters

    • message: Message

      the reply message

    Returns Reply<Message>

    the updated reply

  • Attach metadata to this reply.

    Parameters

    • Optional metadata: Metadata

      metadata to send with the reply

    Returns Reply<Message>

    the updated reply

  • getForward(): undefined | Reply<any>
  • Make this a forwarding reply.

    Parameters

    • forward: Reply<any>

      the forward reply

    Returns Reply<Message>

    the updated reply

  • Make this a failure reply.

    Parameters

    • description: string

      the failure description

    • Optional status: GrpcStatus

      the status code to fail with, defaults to Unknown.

    Returns Reply<Message>

    the updated reply

  • Attach the given effect to this reply.

    Parameters

    • method: EffectMethod

      the entity service method to invoke

    • message: any

      the message to send to that service

    • synchronous: boolean = false

      whether the effect should be execute synchronously or not, default is false

    • metadata: undefined | Metadata = undefined

      metadata to send with the effect

    Returns Reply<Message>

    this reply after adding the effect

  • Attach the given effects to this reply.

    Parameters

    • effects: Effect[]

      service calls to execute as side effects

    Returns Reply<Message>

    this reply after adding the effects

  • isEmpty(): boolean
  • Whether this reply is empty: does not have a message, forward, or failure.

    Returns boolean

    whether the reply is empty

Generated using TypeDoc