Default lifecycle phase for this extension when unspecified in configuration.
Defaults to 'pre-auth' for backwards compatibility.
Health check for this extension.
Called by MJServer's aggregate /health/extensions endpoint.
Should be fast (< 100ms) and non-blocking.
Health status including whether the extension is operational.
Initialize the extension. Called once during MJServer startup.
Supports both modern context-based signature:
Initialize(context: ServerExtensionInitContext): Promise<ExtensionInitResult>
and legacy 2-argument signature:
Initialize(app: Application, config: ServerExtensionConfig): Promise<ExtensionInitResult>
Optionalconfig: ServerExtensionConfigOptionalOnOptional lifecycle hook called after ALL extensions have been mounted across all phases. Ideal for cross-extension service wiring (e.g. connecting a webhook router to a telephony service).
OptionalOnOptional: Called when configuration changes at runtime.
Not all extensions need to support hot-reloading of configuration. Override this method if your extension can dynamically adjust its behavior without a full restart.
The updated configuration from mj.config.cjs.
Graceful shutdown. Called when MJServer is shutting down (SIGTERM/SIGINT).
Clean up connections, drain in-flight requests, close WebSocket connections, and release any resources held by the extension.
This method should complete within a reasonable timeout (< 5 seconds). MJServer enforces a 10-second forced shutdown if graceful shutdown hangs.
Mounts
POST {RootPath}/topics/{topic}/messagesafter MJServer's unified authentication (03 §9). Its health check also reports this process's WorkQueueHost, when one is running.