Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides convenience methods for observing IO values and for monitoring changes in the association state of specific IO actors.

Hierarchy

Index

Constructors

constructor

Accessors

communicationManager

container

options

registeredName

  • get registeredName(): string
  • Gets the registered name of this controller.

    The registered name is either defined by the corresponding key in the Components.controllers object in the container configuration, or by invoking Container.registerController method with this name.

    Returns string

runtime

Methods

Protected extendLogObject

  • extendLogObject(log: Log): void
  • Whenever one of the controller's log methods (e.g. logDebug, logInfo, logWarning, logError, logFatal) is called by application code, the controller creates a Log object with appropriate property values and passes it to this method before advertising it.

    You can override this method to additionally set certain properties (such as LogHost.hostname or Log.logLabels). Ensure that super.extendLogObject is called in your override. The base method does nothing.

    Parameters

    • log: Log

      log object to be extended before being advertised

    Returns void

getIoValue

  • Gets the lastest IO value emitted to the given IO actor or undefined if none exists yet.

    Type parameters

    • T

    Parameters

    Returns T

    the latest IO value for the given actor if one exists

isAssociated

  • isAssociated<T>(actor: IoActor): boolean

logDebug

  • logDebug(message: string, ...tags: string[]): void

logError

  • logError(error: any, message: string, ...tags: string[]): void
  • Advertise a Log object for an error.

    Parameters

    • error: any

      an error (object)

    • message: string

      additional error message

    • Rest ...tags: string[]

      any number of log tags

    Returns void

logErrorWithStacktrace

  • logErrorWithStacktrace(error: any, message: string, ...tags: string[]): void

logFatal

  • logFatal(error: any, message: string, ...tags: string[]): void
  • Advertise a Log object for a fatal error.

    Parameters

    • error: any

      an error (object)

    • message: string

      additional error message

    • Rest ...tags: string[]

      any number of log tags

    Returns void

logInfo

  • logInfo(message: string, ...tags: string[]): void

logWarning

  • logWarning(message: string, ...tags: string[]): void

observeAssociation

  • observeAssociation<T>(actor: IoActor): Observable<boolean>
  • Listen to associations or disassociations for the given IO actor. The returned observable emits distinct boolean values until changed, i.e true when the first association is made and false, when the last association becomes disassociated. When subscribed, the current association state is emitted immediately.

    remarks

    Note that subscriptions on the observable returned must be manually unsubscribed by the application; they are not automatically unsubscribed when communication manager is stopped.

    Type parameters

    • T

    Parameters

    Returns Observable<boolean>

observeIoValue

  • observeIoValue<T>(actor: IoActor): Observable<T>
  • Listen to IO values for the given IO actor. The returned observable always emits the last value received for the given IO actor. When subscribed, the current value (or undefined if none exists yet) is emitted immediately.

    Due to this behavior the cached value of the observable will also be emitted after reassociation. If this is not desired use this.communicationManager.observeIoValue instead. This method doesn't cache any previously emitted value.

    remarks

    Note that subscriptions on the observable returned must be manually unsubscribed by the application; they are not automatically unsubscribed when communication manager is stopped.

    Type parameters

    • T

    Parameters

    Returns Observable<T>

    an observable emitting IO values for the given actor

onCommunicationManagerStarting

  • onCommunicationManagerStarting(): void

onCommunicationManagerStopping

  • onCommunicationManagerStopping(): void

onDispose

  • onDispose(): void
  • Called by the container when this instance should be disposed.

    Implement cleanup side effects here. Ensure that super.onDispose is called in your override. The base implementation does nothing.

    Returns void

onInit

  • onInit(): void
  • Called when the container has completely set up and injected all dependency components, including all its controllers.

    Override this method to perform initializations in your custom controller class instead of defining a constructor. Although the base implementation does nothing it is good practice to call super.onInit() in your override method; especially if your custom controller class does not extend from the base Controller class directly.

    Returns void

Generated using TypeDoc