Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Message<T>

Represents a message that is received from the event bus in a handler.

Messages have a {@link Message#body}, which can be null, and also {@link Message#headers}, which can be empty.

If the message was sent specifying a reply handler, it can be replied to using {@link Message#reply}.

If you want to notify the sender that processing failed, then {@link Message#fail} can be called.

Type parameters

  • T

Hierarchy

  • Message

Index

Methods

address

  • address(): string
  • The address the message was sent to

    Returns string

body

  • body(): T
  • The body of the message. Can be null.

    Returns T

fail

  • fail(failureCode: number, message: string): void
  • Signal to the sender that processing of this message failed.

    If the message was sent specifying a result handler the handler will be called with a failure corresponding to the failure code and message specified here.

    Parameters

    • failureCode: number
    • message: string

    Returns void

headers

  • Multi-map of message headers. Can be empty

    Returns MultiMap

isSend

  • isSend(): boolean
  • Signals if this message represents a send or publish event.

    Returns boolean

reply

  • reply(message: any | null | undefined): void
  • reply(message: any | null | undefined, options: DeliveryOptions): void
  • Reply to this message.

    If the message was sent specifying a reply handler, that handler will be called when it has received a reply. If the message wasn't sent specifying a receipt handler this method does nothing.

    Parameters

    • message: any | null | undefined

    Returns void

  • Link {@link Message#reply} but allows you to specify delivery options for the reply.

    Parameters

    Returns void

replyAddress

  • replyAddress(): string | null
  • The reply address. Can be null.

    Returns string | null

replyAndRequest

  • Reply to this message, specifying a replyHandler for the reply - i.e. to receive the reply to the reply.

    If the message was sent specifying a reply handler, that handler will be called when it has received a reply. If the message wasn't sent specifying a receipt handler this method does nothing.

    Type parameters

    • R

    Parameters

    • message: any | null | undefined

    Returns PromiseLike<Message<R>>

  • Reply to this message, specifying a replyHandler for the reply - i.e. to receive the reply to the reply.

    If the message was sent specifying a reply handler, that handler will be called when it has received a reply. If the message wasn't sent specifying a receipt handler this method does nothing.

    Type parameters

    • R

    Parameters

    Returns void

  • Like {@link Message#replyAndRequest} but specifying options that can be used to configure the delivery.

    Type parameters

    • R

    Parameters

    Returns PromiseLike<Message<R>>

  • Like {@link Message#replyAndRequest} but specifying options that can be used to configure the delivery.

    Type parameters

    • R

    Parameters

    Returns void

Generated using TypeDoc