/// <reference types="node" />
import * as amqplib from "amqplib";
import { TokenUser, User } from "@openiap/openflow-api";
import { Span } from "@opentelemetry/api";
import * as events from "events";
type QueueOnMessage = (msg: string, options: QueueMessageOptions, ack: any, done: any) => void;
export type exchangealgorithm = "direct" | "fanout" | "topic" | "header";
export type QueueMessageOptions = {
    correlationId: string;
    replyTo: string;
    consumerTag: string;
    routingKey: string;
    exchangename: string;
    priority: number;
};
export type AssertQueue = {
    consumerCount: number;
    messageCount: number;
    queue: string;
};
export declare class Deferred<T> {
    promise: Promise<T>;
    reject: any;
    resolve: any;
    constructor();
}
export declare class amqpqueue {
    queue: string;
    queuename: string;
    callback: QueueOnMessage;
    ok: AssertQueue;
    QueueOptions: any;
    consumerTag: string;
}
export declare class amqpexchange {
    exchange: string;
    algorithm: string;
    routingkey: string;
    queue: amqpqueue;
    callback: QueueOnMessage;
    ok: amqplib.Replies.AssertExchange;
    ExchangeOptions: any;
}
export declare interface amqpwrapper {
    on(event: 'connected', listener: () => void): this;
    on(event: 'disconnected', listener: () => void): this;
    on(event: string, listener: Function): this;
}
export declare class amqpwrapper extends events.EventEmitter {
    static waitFor(condition: any, callback: any): void;
    static asyncWaitFor(condition: any): Promise<unknown>;
    connected: boolean;
    private conn;
    private channel;
    private connectionstring;
    AssertExchangeOptions: any;
    AssertQueueOptions: amqplib.Options.AssertQueue;
    private activecalls;
    private queues;
    private exchanges;
    private replyqueue;
    private static _instance;
    static Instance(): amqpwrapper;
    static SetInstance(instance: amqpwrapper): void;
    constructor(connectionstring: string);
    private timeout;
    queuemessagecounter: object;
    incqueuemessagecounter(queuename: string): number;
    conn_error(error: any): void;
    conn_close(): void;
    channel_error(error: any): void;
    connect(parent: Span): Promise<void>;
    shutdown(): void;
    reply_queue_message(msg: any, options: QueueMessageOptions, ack: any, done: any): void;
    reply_queue_return(e1: any): Promise<void>;
    reply_queue_close(msg: any): Promise<void>;
    AddReplyQueue(parent: Span): Promise<void>;
    RemoveQueueConsumer(user: TokenUser | User, queue: amqpqueue, parent: Span): Promise<void>;
    AddQueueConsumer(user: TokenUser | User, queuename: string, QueueOptions: any, jwt: string, callback: QueueOnMessage, parent: Span): Promise<amqpqueue>;
    AddExchangeConsumer(user: TokenUser | User, exchange: string, algorithm: exchangealgorithm, routingkey: string, ExchangeOptions: any, jwt: string, addqueue: boolean, callback: QueueOnMessage, parent: Span): Promise<amqpexchange>;
    OnMessage(sender: amqpqueue, msg: amqplib.ConsumeMessage, callback: QueueOnMessage): void;
    sendWithReply(exchange: string, queue: string, data: any, expiration: number, correlationId: string, routingkey: string, span: Span): Promise<string>;
    sendWithReplyTo(exchange: string, queue: string, replyTo: string, data: any, expiration: number, correlationId: string, routingkey: string, span: Span, priority?: number): Promise<void>;
    send(exchange: string, queue: string, data: any, expiration: number, correlationId: string, routingkey: string, span: Span, priority?: number): Promise<void>;
    Adddlx(span: Span): Promise<void>;
    IsMyconsumerTag(consumerTag: string): boolean;
    IsMyQueue(queuename: string): boolean;
    of_logger_ready: boolean;
    AddOFLogExchange(parent: Span): Promise<void>;
    AddOFExchange(parent: Span): Promise<void>;
}
export {};
