import { Context, Deferred, Service, ServiceContext, NextInvokeHandler } from '@hprose/rpc-core';
import { Message } from './Message';
export interface Producer {
    readonly from: string;
    unicast(data: any, topic: string, id: string): boolean;
    multicast(data: any, topic: string, id: string[]): {
        [id: string]: boolean;
    };
    broadcast(data: any, topic: string): {
        [id: string]: boolean;
    };
    push(data: any, topic: string, id?: string | string[]): boolean | {
        [id: string]: boolean;
    };
    deny(id?: string, topic?: string): void;
    exists(topic: string, id?: string): boolean;
    idlist(topic: string): string[];
}
export interface BrokerContext extends ServiceContext {
    producer: Producer;
}
export declare class Broker {
    readonly service: Service;
    protected messages: {
        [id: string]: {
            [topic: string]: Message[] | null;
        };
    };
    protected responders: {
        [id: string]: Deferred<any>;
    };
    protected timers: {
        [id: string]: Deferred<boolean>;
    };
    messageQueueMaxLength: number;
    timeout: number;
    heartbeat: number;
    onsubscribe?: (id: string, topic: string, context: ServiceContext) => void;
    onunsubscribe?: (id: string, topic: string, messages: any[] | null, context: ServiceContext) => void;
    constructor(service: Service);
    protected send(id: string, responder: Deferred<any>): boolean;
    protected doHeartbeat(id: string): void;
    protected id(context: ServiceContext): string;
    protected subscribe(topic: string, context: ServiceContext): boolean;
    protected response(id: string): void;
    protected offline(topics: {
        [topic: string]: Message[] | null;
    }, id: string, topic: string, context: ServiceContext): boolean;
    protected unsubscribe(topic: string, context: ServiceContext): boolean;
    protected message(context: ServiceContext): Promise<any>;
    unicast(data: any, topic: string, id: string, from?: string): boolean;
    multicast(data: any, topic: string, ids: string[], from?: string): {
        [id: string]: boolean;
    };
    broadcast(data: any, topic: string, from?: string): {
        [id: string]: boolean;
    };
    push(data: any, topic: string, id?: string | string[], from?: string): boolean | {
        [id: string]: boolean;
    };
    deny(id: string, topic?: string): void;
    exists(topic: string, id: string): boolean;
    idlist(topic: string): string[];
    protected handler: (name: string, args: any[], context: Context, next: NextInvokeHandler) => Promise<any>;
}
//# sourceMappingURL=Broker.d.ts.map