Connectum API Reference / @connectum/core / defineLazyService
Function: defineLazyService()
defineLazyService<
S>(descriptor,factory,options?):ServiceDefinition
Defined in: packages/core/src/defineService.ts:91
Define a service whose handlers (and their dependencies) are created lazily.
factory runs only when the service is actually mounted locally — i.e. when it is in enabledServices (or enabledServices is undefined). A service routed to a remote process never instantiates its local dependencies. Useful for DI-heavy monoliths where wiring a service is expensive.
Type Parameters
S
S extends DescService
Parameters
descriptor
S
factory
() => ConnectumServiceImpl<S>
options?
Partial<UniversalHandlerOptions>
