UNPKG

@cloudamqp/amqp-client

Version:

AMQP 0-9-1 client, both for browsers (WebSocket) and node (TCP Socket)

57 lines 2.36 kB
import type { AMQPChannel } from "./amqp-channel.js"; import type { AMQPProperties } from "./amqp-properties.js"; import type { ParserMap } from "./amqp-codec-registry.js"; import type { ResolveMessageBody } from "./amqp-publisher.js"; /** * AMQP message. * * The generic parameter `P` is the parser map type. When no parsers are * configured (`P = {}`), `body` is `Uint8Array | null` (raw wire bytes). * When parsers are configured, `body` is the union of all parser output * types plus `Uint8Array | null`. */ export declare class AMQPMessage<P extends ParserMap = {}> { /** Channel this message was delivered on. */ channel: AMQPChannel; /** Exchange the message was published to. */ exchange: string; /** Routing key the message was published with. */ routingKey: string; /** Message metadata (content-type, headers, etc.). */ properties: AMQPProperties; /** Byte size of the body. */ bodySize: number; /** Message body. Raw `Uint8Array` bytes in plain mode; decoded value in codec mode. */ body: ResolveMessageBody<P>; /** Server-assigned delivery tag for ack/nack/reject. */ deliveryTag: number; /** Consumer tag, if delivered to a consumer. */ consumerTag: string; /** Whether the message has been redelivered by the server. */ redelivered: boolean; /** Number of messages remaining in the queue (only set by basicGet). */ messageCount?: number; /** Reply code if the message was returned. */ replyCode?: number; /** Reason the message was returned. */ replyText?: string; private acked; /** True if the message has already been acked, nacked, or rejected. */ get isAcked(): boolean; /** * @param channel - Channel this message was delivered on */ constructor(channel: AMQPChannel); /** Converts the raw message body to a string. */ bodyToString(): string | null; bodyString(): string | null; /** Acknowledge the message */ ack(multiple?: boolean): Promise<void>; /** Negative acknowledgment (same as reject) */ nack(requeue?: boolean, multiple?: boolean): Promise<void>; /** Reject the message */ reject(requeue?: boolean): Promise<void>; /** Cancel the consumer the message arrived to **/ cancelConsumer(): Promise<AMQPChannel>; } //# sourceMappingURL=amqp-message.d.ts.map