import { Transport } from './transport'; import { Event, Command, Message, MessageAttributes } from '@node-ts/bus-messages'; import { TransportMessage } from './transport-message'; import { CoreDependencies } from '../util'; import { InMemoryQueueConfiguration } from './in-memory-queue-configuration'; export interface InMemoryMessage { /** * If the message is currently being handled and not visible to other consumers */ inFlight: boolean; /** * The number of times the message has been fetched from the queue */ seenCount: number; /** * The body of the message that was sent by the consumer */ payload: Message; } /** * An in-memory message queue. This isn't intended for production use as all messages * are kept in memory and hence will be wiped when the application or host restarts. * * There are however legitimate uses for in-memory queues such as decoupling of non-mission * critical code inside of larger applications; so use at your own discretion. */ export declare class InMemoryQueue implements Transport { private memoryQueueConfiguration; private queue; private queuePushed; private _deadLetterQueue; private messagesWithHandlers; private logger; private coreDependencies; constructor(memoryQueueConfiguration?: InMemoryQueueConfiguration); prepare(coreDependencies: CoreDependencies): void; initialize(): Promise; dispose(): Promise; publish(event: TEvent, messageOptions?: MessageAttributes): Promise; send(command: TCommand, messageOptions?: MessageAttributes): Promise; fail(transportMessage: TransportMessage): Promise; readNextMessage(): Promise | undefined>; deleteMessage(message: TransportMessage): Promise; returnMessage(message: TransportMessage): Promise; /** * Gets the queue depth, which is the number of messages both queued and in flight */ get depth(): number; get deadLetterQueueDepth(): number; /** * Returns all messages sitting in the dead letter queue. This is a copy of the queue * so mutative actions on this array will have no consequence. */ get deadLetterQueue(): TransportMessage[]; /** * Gets the number of messages in the queue, excluding those in flight */ get numberMessagesVisible(): number; private sendToDeadLetterQueue; private addToQueue; } export declare const toTransportMessage: (message: Message, messageOptions: MessageAttributes, isProcessing: boolean) => TransportMessage;