QueryBus

  
class QueryBus<QueryBase extends IQuery = IQuery> extends ObservableBus implements IQueryBus {
  publisher: IQueryPublisher<QueryBase>
  execute<T extends QueryBase, TResult = any>(query: T): Promise<TResult>
  bind<T extends QueryBase, TResult = any>(handler: IQueryHandler<T, TResult>, queryId: string)
  register(handlers: Type<IQueryHandler<QueryBase, QueryResultBase>>[] = [])
  protected registerHandler(handler: Type<IQueryHandler<QueryBase, QueryResultBase>>)

  // inherited from cqrs/src/ObservableBus
  constructor()
  protected _subject$: Subject<T>
  subject$
}

Properties

Property Description
publisher: IQueryPublisher<QueryBase>

Methods

execute()


execute<T extends QueryBase, TResult = any>(query: T): Promise<TResult>

Parameters

Option Type Description
query T

Returns

Promise<TResult>

bind()


bind<T extends QueryBase, TResult = any>(handler: IQueryHandler<T, TResult>, queryId: string)

Parameters

Option Type Description
handler IQueryHandler
queryId string

register()


register(handlers: Type<IQueryHandler<QueryBase, QueryResultBase>>[] = [])

Parameters

Option Type Description
handlers Type>[]

Optional. Default is [].

registerHandler()


protected registerHandler(handler: Type<IQueryHandler<QueryBase, QueryResultBase>>)

Parameters

Option Type Description
handler Type>