EventHandlingMixin

Hierarchy

OneToManyHandlingMixin

  • OneToManyHandlingMixin

    EventHandlingMixin

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new EventHandlingMixin(): EventHandlingMixin

Inherited from HandlingMixin.constructor

Overrides void

Returns: EventHandlingMixin

Properties

eventBus

eventBus: EventBus

Methods

ensureHandleability

ensureHandleability(messageType: MessageTypeMessage›, handleableTypes?: MessageTypeMessage› | MessageTypeMessage›[]): boolean

Implementation of Publisher

Inherited from HandlingMixin.ensureHandleability

Overrides CancelingEmployment.ensureHandleability

Parameters:

NameType
messageTypeMessageTypeMessage
handleableTypes?MessageTypeMessage› | MessageTypeMessage›[]

Returns: boolean


getHandleableTypes

getHandleableTypes(): MessageTypeMessage›[]

Implementation of Publisher

Inherited from HandlingMixin.getHandleableTypes

Overrides CancelingEmployment.getHandleableTypes

Returns: MessageTypeMessage›[]


getHandled

getHandled(messageType: MessageTypeMessage›): MessageTypeMessage›[]

Implementation of Publisher

Inherited from HandlingMixin.getHandled

Overrides CancelingEmployment.getHandled

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: MessageTypeMessage›[]


getHandledCommands

getHandledCommands(): MessageTypeCommand›[]

Inherited from HandlingMixin.getHandledCommands

Overrides CancelingEmployment.getHandledCommands

Returns: MessageTypeCommand›[]


getHandledEvents

getHandledEvents(): MessageTypeEvent›[]

Inherited from HandlingMixin.getHandledEvents

Overrides CancelingEmployment.getHandledEvents

Returns: MessageTypeEvent›[]


getHandledMessages

getHandledMessages(): MessageTypeMessage›[]

Inherited from HandlingMixin.getHandledMessages

Overrides CancelingEmployment.getHandledMessages

Returns: MessageTypeMessage›[]


getHandledTypes

getHandledTypes(): MessageTypeMessage›[]

Implementation of Publisher

Inherited from HandlingMixin.getHandledTypes

Overrides CancelingEmployment.getHandledTypes

Returns: MessageTypeMessage›[]


getHandledTypesNames

getHandledTypesNames(): TypeName[]

Inherited from HandlingMixin.getHandledTypesNames

Overrides CancelingEmployment.getHandledTypesNames

Returns: TypeName[]


getHandler

getHandler(messageType: MessageTypeMessage›): Handler[] | undefined

Implementation of Publisher

Inherited from OneToManyHandlingMixin.getHandler

Overrides void

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: Handler[] | undefined


getHandlerOrThrow

getHandlerOrThrow(messageType: MessageTypeMessage›): Handler[]

Implementation of Publisher

Inherited from OneToManyHandlingMixin.getHandlerOrThrow

Overrides void

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: Handler[]


getHandlers

getHandlers(): Map‹MessageTypeMessage›, Handler | Handler[]›

Implementation of Publisher

Inherited from HandlingMixin.getHandlers

Overrides CancelingEmployment.getHandlers

Returns: Map‹MessageTypeMessage›, Handler | Handler[]›


getSubscribedEvents

getSubscribedEvents(): MessageTypeEvent›[]

alias getHandledEvents

Returns: MessageTypeEvent›[]


getTypeByHandler

getTypeByHandler(handlerReference: Handler): any | undefined

Inherited from OneToManyHandlingMixin.getTypeByHandler

Overrides void

Parameters:

NameType
handlerReferenceHandler

Returns: any | undefined


handle

handle(message: Message, execution?: Execution): Promise‹void›

Implementation of Publisher

Inherited from OneToManyHandlingMixin.handle

Overrides void

Parameters:

NameType
messageMessage
execution?Execution

Returns: Promise‹void›


handles

handles(): Map‹MessageTypeCommand›, Handler

Implementation of Publisher

Inherited from HandlingMixin.handles

Overrides CancelingEmployment.handles

Returns: Map‹MessageTypeCommand›, Handler


hasHandler

hasHandler(messageType: MessageTypeMessage›): boolean

Implementation of Publisher

Inherited from HandlingMixin.hasHandler

Overrides CancelingEmployment.hasHandler

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: boolean


initialize

initialize(): void

Implementation of Publisher

Overrides OneToManyHandlingMixin.initialize

Initializes EventHandlingMixin.

remarks By defining handler mappings on metadata with annotations: @subscribe and resolving those mapping with subscribes method - it ensures, that there is no leakage in between inheriting classes.

Returns: void


isHandleabe

isHandleabe(messageType: MessageTypeMessage›, handleableTypes?: MessageTypeMessage› | MessageTypeMessage›[]): boolean

Inherited from HandlingMixin.isHandleabe

Overrides CancelingEmployment.isHandleabe

Parameters:

NameType
messageTypeMessageTypeMessage
handleableTypes?MessageTypeMessage› | MessageTypeMessage›[]

Returns: boolean


on

on(event: Event): Promise‹void›

alias handle

async

Parameters:

NameTypeDescription
eventEventInstance implementing Event interface.

Returns: Promise‹void›


overrideHandler

overrideHandler(messageType: MessageTypeMessage›, handler: Handler): void

Implementation of Publisher

Inherited from HandlingMixin.overrideHandler

Overrides CancelingEmployment.overrideHandler

Parameters:

NameType
messageTypeMessageTypeMessage
handlerHandler

Returns: void


publish

publish(event: Event): Promise‹void›

Implementation of Publisher

Publishes(handles) event instance on event bus.

async

Parameters:

NameTypeDescription
eventEventInstance implementing Event interface.

Returns: Promise‹void›


registerEventHandler

registerEventHandler(eventType: MessageTypeEvent›, handler: Handler, shouldOverride?: boolean): void

Registers event handler and subscribes to that event on event bus.

throws {UnhandleableTypeError} Thrown if the type argument is not one of handleable types.

throws {InvalidHandlerError} Thrown if the handler argument is not a function.

Parameters:

NameTypeDescription
eventTypeMessageTypeEventA Event type for which handler mapping will be created.
handlerHandlerHandler function that will executed upon handling type.
shouldOverride?booleanFlag indicating that handler should be overridden if exist.

Returns: void


registerHandler

registerHandler(messageType: MessageTypeMessage›, handler: Handler, shouldOverride?: boolean): void

Implementation of Publisher

Inherited from OneToManyHandlingMixin.registerHandler

Overrides HandlingMixin.registerHandler

Parameters:

NameType
messageTypeMessageTypeMessage
handlerHandler
shouldOverride?boolean

Returns: void


removeHandler

removeHandler(messageType: MessageTypeMessage›): void

Implementation of Publisher

Inherited from HandlingMixin.removeHandler

Overrides CancelingEmployment.removeHandler

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: void


setHandleableTypes

setHandleableTypes(handleableTypes: MessageTypeMessage› | MessageTypeMessage›[]): void

Implementation of Publisher

Inherited from HandlingMixin.setHandleableTypes

Overrides CancelingEmployment.setHandleableTypes

Parameters:

NameType
handleableTypesMessageTypeMessage› | MessageTypeMessage›[]

Returns: void


subscribeTo

subscribeTo(eventType: MessageTypeEvent›, handler: Handler, shouldOverride?: boolean): void

Subscribes to event(registers handler).

alias registerEventHandler

Parameters:

NameType
eventTypeMessageTypeEvent
handlerHandler
shouldOverride?boolean

Returns: void


subscribes

subscribes(): Map‹MessageTypeEvent›, Handler

Implementation of Publisher

Inherited from HandlingMixin.subscribes

Overrides CancelingEmployment.subscribes

Returns: Map‹MessageTypeEvent›, Handler