Options
All
  • Public
  • Public/Protected
  • All
Menu

MMRP Envelopes are used to encapsulate data to be sent between MAGE nodes.

class

MmrpEnvelope

Hierarchy

  • MmrpEnvelope

Index

Constructors

constructor

Properties

messages

List of messages

type

{MmrpEnvelopeMessage[]}

memberof

MmrpEnvelope

Optional returnRoute

returnRoute: MmrpEnvelopeRoute

Return route

This will be set on envelopes received by .on(delivery) if envelope.setFlag('TRACK_ROUTE') was called before sending the envelope.

The returnRoute can then be used after reception to send back a reply if needed.

Methods

addMessage

consumeRoute

  • consumeRoute(identity?: string): void
  • Removes a route part from the start of the route, if the value matches, or empties the entire route if the given identity is undefined

    memberof

    MmrpEnvelope

    Parameters

    • Optional identity: string

    Returns void

getFinalDestination

  • getFinalDestination(): string
  • Returns the final address in the route

    memberof

    MmrpEnvelope

    Returns string

getFlags

  • getFlags(): string[]
  • Retrieves the flags's string representation

    memberof

    MmrpEnvelope

    Returns string[]

getInitialSource

  • getInitialSource(): string
  • Returns the final portion of the return route

    This identifies the node on which the original sender resides.

    memberof

    MmrpEnvelope

    Returns string

hasReturnRoute

  • hasReturnRoute(): boolean
  • Returns true if this envelope tracks and contains the sender's route, false otherwise

    memberof

    MmrpEnvelope

    Returns boolean

injectRoute

  • Prepends a route to the existing envelope route

    memberof

    MmrpEnvelope

    Parameters

    Returns void

injectSender

  • injectSender(route: string): void
  • Prepends a route to the existing return route

    memberof

    MmrpEnvelope

    Parameters

    • route: string

    Returns void

isFlagged

  • isFlagged(): boolean
  • True if a flag is set

    memberof

    MmrpEnvelope

    Returns boolean

routeRemains

  • routeRemains(): boolean
  • Returns true if the route has not been fully consumed, false otherwise

    memberof

    MmrpEnvelope

    Returns boolean

setFlag

setMessage

  • Sets the message part(s) of the envelope

    The event name is what one will listen to, but prefixed with 'delivery.'. Example:

    mmrpNode.on('delivery.MyEventName', (...args) => console.log(...args))
    
    memberof

    MmrpEnvelope

    Parameters

    Returns void

setMeta

setReturnRoute

  • Set the return route for this message

    Used whenever a reply is required

    memberof

    MmrpEnvelope

    Parameters

    Returns void

setRoute

  • Sets the route that the envelope needs to take to reach its destination

    memberof

    MmrpEnvelope

    Parameters

    Returns void