import { link, LinkOptions, AmqpError, Dictionary, Source, TerminusOptions } from "rhea"; import { Session } from "./session"; import { Connection } from "./connection"; import { Entity } from "./entity"; export declare enum LinkType { sender = "sender", receiver = "receiver" } /** * @interface LinkCloseOptions * Describes the options that can be provided while closing the link. */ export interface LinkCloseOptions { /** * Indicates whether the underlying amqp session should also be closed when the * link is being closed. * - **Default: `true`**. */ closeSession?: boolean; } export declare abstract class Link extends Entity { linkOptions?: LinkOptions; type: LinkType; protected _link: link; protected _session: Session; constructor(type: LinkType, session: Session, link: link, options?: LinkOptions); get name(): string; get error(): AmqpError | Error | undefined; get properties(): Dictionary; get sendSettleMode(): 0 | 1 | 2; get receiveSettleMode(): 0 | 1; get source(): Source; set source(fields: Source); get target(): TerminusOptions; set target(fields: TerminusOptions); get maxMessageSize(): number; get offeredCapabilities(): string | string[]; get desiredCapabilities(): string | string[]; get address(): string; get credit(): number; get session(): Session; get connection(): Connection; /** * Determines whether the sender link and its underlying session is open. * @returns {boolean} `true` open. `false` closed. */ isOpen(): boolean; /** * Determines whether the remote end of the link is open. * @return {boolean} boolean `true` - is open; `false` otherwise. */ isRemoteOpen(): boolean; /** * Determines whether the link has credit. * @return {boolean} boolean `true` - has credit; `false` otherwise. */ hasCredit(): boolean; /** * Determines whether the link is a sender. * @return {boolean} boolean `true` - sender; `false` otherwise. */ isSender(): boolean; /** * Determines whether the link is a receiver. * @return {boolean} boolean `true` - receiver; `false` otherwise. */ isReceiver(): boolean; /** * Determines whether both local and remote endpoint for link or it's underlying session * or it's underlying connection are closed. * Within the "sender_close", "session_close" event handler, if this * method returns `false` it means that the local end is still open. It can be useful to * determine whether the close was initiated locally under such circumstances. * * @returns {boolean} `true` if closed, `false` otherwise. */ isClosed(): boolean; /** * Determines whether both local and remote endpoint for just the link itself are closed. * Within the "sender_close" event handler, if this method returns `false` it * means that the local end is still open. It can be useful to determine whether the close * was initiated locally under such circumstances. * * @returns {boolean} `true` - closed, `false` otherwise. */ isItselfClosed(): boolean; /** * Determines whether both local and remote endpoint for session or it's underlying * connection are closed. * * Within the "session_close" event handler, if this method returns `false` it means that * the local end is still open. It can be useful to determine whether the close * was initiated locally under such circumstances. * * @returns {boolean} `true` - closed, `false` otherwise. */ isSessionClosed(): boolean; /** * Determines whether both local and remote endpoint for just the session itself are closed. * Within the "session_close" event handler, if this method returns `false` it means that * the local end is still open. It can be useful to determine whether the close * was initiated locally under such circumstances. * * @returns {boolean} `true` - closed, `false` otherwise. */ isSessionItselfClosed(): boolean; /** * Removes the underlying amqp link and it's session from the internal map in rhea. Also removes * all the event handlers added in the rhea-promise library on the link and it's session. * @returns {void} void */ remove(): void; /** * Closes the underlying amqp link and optionally the session as well in rhea if open. * Also removes all the event handlers added in the rhea-promise library on the link * and optionally it's session. * @returns Promise * - **Resolves** the promise when rhea emits the "sender_close" | "receiver_close" event. * - **Rejects** the promise with an AmqpError when rhea emits the * "sender_error" | "receiver_error" event while trying to close the amqp link. */ close(options?: LinkCloseOptions): Promise; /** * Adds event listeners for the possible events that can occur on the link object and * re-emits the same event back with the received arguments from rhea's event emitter. * @private * @returns {void} void */ private _initializeEventListeners; } //# sourceMappingURL=link.d.ts.map