import { IMessenger } from "./IMessenger.js";
import { EggApplicationCore } from "../../egg.js";
import { BaseMessenger } from "./base.js";
//#region src/lib/core/messenger/local.d.ts
/**
 * Communication between app worker and agent worker with EventEmitter
 */
export declare class Messenger extends BaseMessenger implements IMessenger {
  readonly pid: string;
  constructor(egg: EggApplicationCore);
  /**
   * Send message to all agent and app
   * @param {String} action - message key
   * @param {Object} data - message value
   * @return {Messenger} this
   */
  broadcast(action: string, data?: unknown): Messenger;
  /**
   * send message to the specified process
   * Notice: in single process mode, it only can send to self process,
   * and it will send to both agent and app's messengers.
   * @param {String} workerId - the workerId of the receiver
   * @param {String} action - message key
   * @param {Object} data - message value
   * @return {Messenger} this
   */
  sendTo(workerId: string, action: string, data?: unknown): Messenger;
  /**
   * send message to one worker by random
   * Notice: in single process mode, we only start one agent worker and one app worker
   * - if it's running in agent, it will send to one of app workers
   * - if it's running in app, it will send to agent
   * @param {String} action - message key
   * @param {Object} data - message value
   * @return {Messenger} this
   */
  sendRandom(action: string, data?: unknown): Messenger;
  /**
   * send message to app
   * @param {String} action - message key
   * @param {Object} data - message value
   * @return {Messenger} this
   */
  sendToApp(action: string, data?: unknown): Messenger;
  /**
   * send message to agent
   * @param {String} action - message key
   * @param {Object} data - message value
   * @return {Messenger} this
   */
  sendToAgent(action: string, data?: unknown): Messenger;
  /**
   * @param {String} action - message key
   * @param {Object} data - message value
   * @param {String} to - let master know how to send message
   * @return {Messenger} this
   */
  send(action: string, data: unknown, to?: string): Messenger;
  onMessage(message: any): void;
  close(): void;
}
//#endregion