Skip to content

API reference / @node-ts/bus-core / ContainerAdapter

Interface: ContainerAdapter ​

Defined in: packages/bus-core/src/container/container-adapter.ts:8

An adapter so that resolvers can use a local DI/IoC container to resolve class based handlers and workflows

Methods ​

get() ​

ts
get<T>(type, context?): T | Promise<T>;

Defined in: packages/bus-core/src/container/container-adapter.ts:15

Fetch a class instance from the container

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
typeClassConstructor<T>Type of the class to fetch an instance for
context?{ message?: Message; messageAttributes?: MessageAttributes<MessageAttributeMap, MessageAttributeMap>; }Optional context to pass to the container. This is used in order to allow different resolving containers to be used for different messages.
context.message?Message-
context.messageAttributes?MessageAttributes<MessageAttributeMap, MessageAttributeMap>-

Returns ​

T | Promise<T>

Example ​

ts
get(MessageHandler)

Released under the MIT License.