Home > @imqueue/core > IMessageQueue
IMessageQueue interface
Generic messaging queue implementation interface
Signature:
export interface IMessageQueue extends EventEmitter<EventMap>
Extends: EventEmitter<EventMap>
Example
~~~typescript import { IMessageQueue, EventEmitter } from '@imqueue/core'; import { randomUUID } from 'node:crypto';
class SomeMQAdapter extends EventEmitter implements IMessageQueue { public async start(): Promise
Methods
|
Method |
Description |
|---|---|
|
Clears all queue data from the queue host application. | |
|
Safely destroys the current queue, unregistering all event listeners and closing connections. | |
|
Publishes data to the current queue channel If toName is specified, publishes to a pubsub with a different name. This can be used to broadcast messages to other subscribers on different pubsub channels. Different names must be in the same namespace (same imq prefix). | |
|
Retrieves the current count of messages in the queue. Supposed to be an async function. | |
|
Sends a message to the specified queue with the given data. | |
|
Starts the messaging queue. | |
|
Stops the queue from handling messages. | |
|
Creates or uses a subscription channel with the given name and sets message handler on data receive | |
|
Closes the subscription channel |