|
|
@ -101,10 +101,12 @@ export class Microservice |
|
|
|
|
|
|
|
try { |
|
|
|
// Boot the microservice
|
|
|
|
console.log("Booting services..."); |
|
|
|
this.state = MicroserviceState.Booting; |
|
|
|
await this.boot(); |
|
|
|
|
|
|
|
// Start the microservice
|
|
|
|
console.log("Starting services..."); |
|
|
|
this.state = MicroserviceState.Starting |
|
|
|
await this.onStart(); |
|
|
|
for (let InternalService of Object.values(this.services)) { |
|
|
@ -116,11 +118,13 @@ export class Microservice |
|
|
|
} |
|
|
|
|
|
|
|
// Run the microservice
|
|
|
|
console.log("Running"); |
|
|
|
this.state = MicroserviceState.Running; |
|
|
|
process.on("SIGINT", this.quit.bind(this)); |
|
|
|
let exitCode = await new Promise<number>((resolve) => this.__quitHandler = resolve); |
|
|
|
|
|
|
|
// Shutdown the microservice
|
|
|
|
console.log("Shutting down..."); |
|
|
|
await this.shutdown().catch(() => { |
|
|
|
console.log("Error ocurred during shutdown..."); |
|
|
|
exitCode = 1; |
|
|
|