UNPKG

@mdf.js/service-registry

Version:

MMS - API - Service Registry

48 lines 2.01 kB
/** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ import { LoggerInstance } from '@mdf.js/logger'; import { Aggregator } from '../Aggregator'; import { RegisterMessage } from '../types'; import { Port } from './Port'; /** * WorkerPort class is designed to manage error reporting in a worker process, specifically * within a Node.js cluster. It listens for messages from the master process to either send * back the current error registry or to clear its error records upon request. * * Inherits from the Port class, leveraging its logging functionality to provide insight * into the inter-process communication and error management actions taking place within * the worker process. */ export declare class WorkerPort extends Port { private readonly aggregator; /** * Create an instance of errors manager in a worker process * @param aggregator - Aggregator instance to manage the errors * @param logger - Logger instance for logging activities */ constructor(aggregator: Aggregator, logger: LoggerInstance); /** * Handles requests from the master process, responding with the current error registry or * clearing errors. * @param message - The message received from the master process, containing the request type and * optionally a request ID. */ onMasterRequestHandler: (message: RegisterMessage) => void; /** Clear all the actual error in the registry */ clear(): void; /** * Starts listening for messages from the master process, enabling response to error registry * requests and clear commands. */ start(): void; /** * Stops listening for messages from the master process, effectively disabling further * communication for error registry management. */ stop(): void; } //# sourceMappingURL=WorkerPort.d.ts.map