Options
All
  • Public
  • Public/Protected
  • All
Menu

Event Bus Lower Level API's are available if more control over channels is required, or building extensions using the Monitor API.

Hierarchy

  • EventBusLowApi

Index

Properties

channelMap: Map<string, Channel>

Returns the map for monitoring externally (read-only)

returns

map of all channels.

loggerInstance: Logger

Quick access to logger instance for spies and testing.

ngViewRefreshSubscription?: Subscription

Subscription to Subject that schedules Angular change detection.

Methods

  • close(cname: string, from?: string, observerId?: string): boolean
  • Close a channel. If the closer is the last subscriber, then the channel is destroyed.

    Parameters

    • cname: string

      channel you want to close

    • Optional from: string

      optional calling actor (for logging)

    • Optional observerId: string

      optional id of observer closing (leaving) the channel.

    Returns boolean

  • complete(cname: string, from?: string): boolean
  • Complete the channel stream.

    Parameters

    • cname: string

      channel you want to complete. This channel will no longer broadcast to subscribers.

    • Optional from: string

    Returns boolean

  • countListeners(): number
  • Total number of listeners across all channels.

    Returns number

  • destroyAllChannels(): void
  • Destroy all channels, regardless of whether they still have subscribers. This is intended to be used in afterEach during jasmine tests, so that subscribers from previous tests never fire in subsequent tests.

    Returns void

  • enableMonitorDump(flag: boolean): void
  • Turn logging on/off

    Parameters

    • flag: boolean

      turn logging on/off.

    Returns void

  • error(cname: string, err: any): boolean
  • Transmit error on a channel if it exists.

    Parameters

    • cname: string
    • err: any

    Returns boolean

    true if error can be sent, false if not.

  • getChannel(cname: string, from?: string, noRefCount?: boolean): Observable<Message>
  • Get a subscribable stream from channel. If the channel doesn't exist, it will be created. Automatically unpack wrapped messages.

    Parameters

    • cname: string

      name of the channel you want to subscribe to.

    • Optional from: string

      optional calling actor (for logging)

    • Optional noRefCount: boolean

      optional - will prevent internal reference counting (defaults to false)

    Returns Observable<Message>

    Observable that can be subscribed to, Message object will be ticked on stream.

  • getChannelObject(name: string, from?: string, noRefCount?: boolean, broadcast?: boolean): Channel
  • A new channel is created by the first reference to it. All subsequent references to that channel are handed the same stream to subscribe to. Accessing this method increments the channels reference count. This method subscribes to both command and response messages. See below for specific directional methods. This method is not filtered.

    This is a raw object that encapsulates the channel stream.

    Parameters

    • name: string

      the name of the channel you want.

    • Optional from: string

      optional calling actor (for logging)

    • Optional noRefCount: boolean

      optional - will prevent internal reference counting (defaults to false)

    • Optional broadcast: boolean

      choose to broadcast events to the monitor (defaults to true)

    Returns Channel

  • getErrorChannel(cname: string, from?: string, noRefCount?: boolean): Observable<Message>
  • Filter bus events that contain error messages only. Returns an Observable with un-marshaled Message payload.

    deprecated

    use markChannelAsGalactic() and fabric.generateFabricRequest();

    Parameters

    • cname: string

      name of the channel you want to listen to.

    • Optional from: string

      optional calling actor (for logging)

    • Optional noRefCount: boolean

      optional - will prevent internal reference counting (defaults to false)

    Returns Observable<Message>

    Observable that will emit an error Message to any subscribers.

  • Get or create a galactic channel. Channel will be mapped to broker destination and picked up by the bridge.

    deprecated

    use markChannelAsGalactic()

    Parameters

    • cname: string
    • Optional galacticConfig: ChannelBrokerMapping

      optional - galactic configuration containing information including broker connection string and whether channel is private or not

    • Optional from: string
    • Optional noRefCount: boolean

      optional - will prevent internal reference counting (defaults to false)

    Returns Observable<Message>

  • getId(): string
  • getMonitorStream(): Channel
  • getRequestChannel(name: string, from?: string, noRefCount?: boolean): Observable<Message>
  • Filter bus events that contain command messages only. Returns an Observable with un-marshaled Message payload.

    Parameters

    • name: string

      of the channel you want to listen to.

    • Optional from: string

      optional calling actor (for logging)

    • Optional noRefCount: boolean

      optional - will prevent internal reference counting (defaults to false)

    Returns Observable<Message>

    Observable that will emit a command Message to any subscribers.

  • getResponseChannel(cname: string, from?: string, noRefCount?: boolean): Observable<Message>
  • Filter bus events that contain response messages only. Returns an Observable with un-marshaled Message payload.

    Parameters

    • cname: string

      name of the channel you want to listen to.

    • Optional from: string

      optional calling actor (for logging)

    • Optional noRefCount: boolean

      optional - will prevent internal reference counting (defaults to false)

    Returns Observable<Message>

    Observable that will emit a response Message to any subscribers.

  • increment(cname: string): number
  • Increment a channel ref count. This should only be used by extensions manipulating streams.

    Parameters

    • cname: string

      channel you want to increment

    Returns number

    the new refcount.

  • isLoggingEnabled(): boolean
  • Get current event bus logging state.

    Returns boolean

    true if enabled.

  • Used internally to interact with simpler API's in main event bus.

    Type parameters

    • R

    Parameters

    • handlerConfig: MessageHandlerConfig

      message handler configuration object.

    • Optional requestStream: boolean

      listen to requests? defaults to responses only.

    • Optional name: string

      optional calling actor (for logging)

    • Optional id: string

      enable message tracking if this is supplied

    Returns MessageHandler<R, any>

    reference to MessageHandler

  • logger(): Logger
  • Access to private logger so messages can be sequentialized.

    Returns Logger

    reference to the logger service.

  • messageLog(msg: string, from?: string): void
  • For external access to messagebus private logger (so output streams are sequentialized).

    Parameters

    • msg: string

      log message

    • Optional from: string

      optional calling actor (for logging).

    Returns void

  • ngZone(): any
  • refCount(cname: string): number
  • Get a count of how many references there are to a channel.

    Parameters

    • cname: string

      name of the channel

    Returns number

    number of references currently held.

  • Used internally to send messages to simpler API's in main event bus.

    Type parameters

    • R

    Parameters

    • handlerConfig: MessageHandlerConfig

      message handler configuration object.

    • Optional name: string

      optional calling actor (for logging)

    • Optional id: string

      enable message tracking if this is supplied

    Returns MessageHandler<R, any>

    reference to MessageHandler

  • Used internally to send messages to simple API's in main event bus.

    Type parameters

    • R

    • E = any

    Parameters

    • handlerConfig: MessageHandlerConfig

      message handler configuration object.

    • Optional name: string

      optional calling actor (for logging)

    • Optional id: string

      enable message tracking if this is supplied

    Returns MessageResponder<R, E>

    reference to MessageResponder

  • send(cname: string, message: Message, from?: string): boolean
  • Transmit arbitrary data on a channel on the message bus if it exists. This routine is called with traceback strings to allow for debugging and monitoring bus traffic.

    Parameters

    • cname: string

      channel to send to.

    • message: Message

      Message to be sent.

    • Optional from: string

      optional calling actor (for logging)

    Returns boolean

    true if message can be sent, false if not.

  • sendRequest(cname: string, payload: any, name?: string): void
  • Send simple API message to MessageResponder enabled calls. (non low-level API's)

    Parameters

    • cname: string
    • payload: any
    • Optional name: string

    Returns void

  • sendResponse(cname: string, payload: any, name?: string): void
  • Send simple API message to MessageResponder enabled calls. (non low-level API's)

    Parameters

    • cname: string

      channel name to send response to.

    • payload: any

      payload to send to simple API.

    • Optional name: string

      option name of calling actor (for logging)

    Returns void

  • setLogLevel(logLevel: LogLevel): void
  • Set the log to the desired LogLevel

    Parameters

    • logLevel: LogLevel

      the level you want to set.

    Returns void

  • setUpNgViewRefreshScheduler(): void
  • Set up Subject and subscribe to it that will fire as messages are emitted to trigger Angular change detection. As the name implies, should only be used when in Angular apps.

    Returns void

  • silenceLog(set: boolean): void
  • Silence the log.

    Parameters

    • set: boolean

      the flag to true or false

    Returns void

  • suppressLog(set: boolean): void
  • Set the log suppression on or off

    Parameters

    • set: boolean

      the flag

    Returns void

  • tickEventLoop(func: Function, delay?: number): number
  • Push function onto the queue for next event loop tick.

    Parameters

    • func: Function

      function you want to execute asynchronously.

    • Optional delay: number

      milliseconds you want to delay execution by.

    Returns number

Generated using TypeDoc