Skip to content

Commit

Permalink
preload actuator and event-over-http services
Browse files Browse the repository at this point in the history
  • Loading branch information
acn-ericlaw committed Jul 5, 2024
1 parent 7573906 commit b66b4de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
8 changes: 5 additions & 3 deletions dist/system/rest-automation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/system/rest-automation.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/src/preload/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { parse as parseYaml } from 'yaml';
import { fileURLToPath } from "url";
import { Logger, Platform, ConfigReader, FunctionRegistry } from 'mercury';
// import the user services
// Generated: 2024-05-26 20:49:39.860
// Generated: 2024-06-21 07:31:28.191
import { DemoAuth } from '../services/demo-auth.js';
import { DemoHealthCheck } from '../services/health-check.js';
import { HelloWorldService } from '../services/hello-world-service.js';
Expand Down
10 changes: 6 additions & 4 deletions src/system/rest-automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,18 @@ class RestEngine {
.split(',').filter(v => v.length > 0).map(v => v.toLowerCase());
if (!this.traceIdLabels.includes('x-trace-id')) {
this.traceIdLabels.push('x-trace-id');
}
const actuator = new ActuatorServices();
this.actuatorRouteName = actuator.getName();
platform.register(actuator.getName(), actuator.handleEvent, true, 10);
}
}

startHttpServer(): void {
if (!this.loaded) {
this.loaded = true;
let restEnabled = false;
// preload actuator services
const actuator = new ActuatorServices();
this.actuatorRouteName = actuator.getName();
platform.register(actuator.getName(), actuator.handleEvent, true, 10);
// preload Event-over-HTTP service
const eventApiService = new EventApiService();
platform.register(eventApiService.getName(), eventApiService.handleEvent, true, 200);
platform.register(REST_AUTOMATION_MANAGER, housekeeper);
Expand Down

0 comments on commit b66b4de

Please sign in to comment.