///
///
import { Delivery, Message, Sender as RheaSender } from "rhea";
import { BaseSender, BaseSenderOptions } from "./sender";
import { SenderEvents } from "rhea";
import { OnAmqpEvent } from "./eventContext";
import { Session } from "./session";
import { AbortSignalLike } from "./util/utils";
/**
* Describes the interface for the send operation Promise which contains a reference to resolve,
* reject functions and the timer for that Promise.
* @interface PromiseLike
*/
export interface PromiseLike {
resolve: (value?: any) => void;
reject: (reason?: any) => void;
timer: NodeJS.Timer;
}
/**
* Describes the event listeners that can be added to the AwaitableSender.
* @interface Sender
*/
export declare interface AwaitableSender {
on(event: SenderEvents, listener: OnAmqpEvent): this;
}
export type AwaitableSenderOptions = BaseSenderOptions;
export interface AwaitableSendOptions {
/**
* The duration in which the promise to send the message should complete (resolve/reject).
* If it is not completed, then the Promise will be rejected after timeout occurs.
* Default: `20 seconds`.
*/
timeoutInSeconds?: number;
/**
* A signal to cancel the send operation. This does not guarantee that the message will not be
* sent. It only stops listening for an acknowledgement from the remote endpoint.
*/
abortSignal?: AbortSignalLike;
/**
* The message format. Specify this if a message with custom format needs to be sent.
* `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
*/
format?: number;
/**
* The message tag if any.
*/
tag?: Buffer | string;
}
/**
* Describes the sender where one can await on the message being sent.
* @class AwaitableSender
*/
export declare class AwaitableSender extends BaseSender {
/**
* @property {Map;
constructor(session: Session, sender: RheaSender, options?: AwaitableSenderOptions);
/**
* Sends the message on which one can await to ensure that the message has been successfully
* delivered.
* @param {Message | Buffer} msg The message to be sent. For default AMQP format msg parameter
* should be of type Message interface. For a custom format, the msg parameter should be a Buffer
* and a valid value should be passed to the `format` argument.
* @param {AwaitableSendOptions} [options] Options to configure the timeout, cancellation for
* the send operation and the tag and message format of the message.
* @returns {Promise} Promise The delivery information about the sent message.
*/
send(msg: Message | Buffer, options?: AwaitableSendOptions): Promise;
}
//# sourceMappingURL=awaitableSender.d.ts.map