diff --git a/packages/microservice/src/InternalService.ts b/packages/microservice/src/InternalService.ts index 12da069..3e02dc9 100644 --- a/packages/microservice/src/InternalService.ts +++ b/packages/microservice/src/InternalService.ts @@ -45,7 +45,14 @@ export abstract class InternalService ext // no-op } - // Miscellaneous ------------------------------------------------------------------------------ + // Miscellaneous ------------------------------------------------------------------------------ + + /** + * Link to local services + */ + public link(app: T) { + // no-op + } /** * Indicate the application is ready diff --git a/packages/microservice/src/Microservice.ts b/packages/microservice/src/Microservice.ts index 1ff7890..f75df6a 100644 --- a/packages/microservice/src/Microservice.ts +++ b/packages/microservice/src/Microservice.ts @@ -105,12 +105,17 @@ export class Microservice this.state = MicroserviceState.Booting; await this.boot(); + // Linking the internal services + for (let service of Object.values(this.service)) { + service.link(this); + } + // Start the microservice console.log("Starting services..."); this.state = MicroserviceState.Starting await this.onStart(); - for (let InternalService of Object.values(this.services)) { - InternalService.start(); + for (let service of Object.values(this.services)) { + service.start(); } } catch(e) { console.error("Failed to start the microservice:", e);