Interface PublisherProps

interface PublisherProps {
    confirm?: boolean;
    exchangeBindings?: {
        arguments?: Record<string, any>;
        destination: string;
        routingKey?: string;
        source: string;
    }[];
    exchanges?: {
        arguments?: {
            alternate-exchange?: string;
            [k: string]: any;
        };
        autoDelete?: boolean;
        durable?: boolean;
        exchange: string;
        internal?: boolean;
        passive?: boolean;
        type?: string;
    }[];
    maxAttempts?: number;
    onReturn?: ((msg) => void);
    queueBindings?: {
        arguments?: Record<string, any>;
        exchange: string;
        queue?: string;
        routingKey?: string;
    }[];
    queues?: {
        arguments?: {
            x-dead-letter-exchange?: string;
            x-dead-letter-routing-key?: string;
            x-expires?: number;
            x-max-length?: number;
            x-max-priority?: number;
            x-message-ttl?: number;
            x-overflow?: "drop-head" | "reject-publish" | "reject-publish-dlx";
            x-queue-type?: "quorum" | "classic" | "stream";
            [k: string]: any;
        };
        autoDelete?: boolean;
        durable?: boolean;
        exclusive?: boolean;
        passive?: boolean;
        queue?: string;
    }[];
}

Properties

confirm?: boolean

Enable publish-confirm mode. See Channel#confirmSelect

exchangeBindings?: {
    arguments?: Record<string, any>;
    destination: string;
    routingKey?: string;
    source: string;
}[]

Define any exchange-exchange bindings to be declared before the first publish and whenever the connection is reset. Same as Channel#exchangeBind()

Type declaration

  • Optional arguments?: Record<string, any>

    A set of arguments for the binding. The syntax and semantics of these arguments depends on the exchange class.

  • destination: string

    Specifies the name of the destination exchange to bind.

  • Optional routingKey?: string

    Specifies the routing key for the binding. The routing key is used for routing messages depending on the exchange configuration. Not all exchanges use a routing key - refer to the specific exchange documentation.

  • source: string

    Specifies the name of the source exchange to bind.

exchanges?: {
    arguments?: {
        alternate-exchange?: string;
        [k: string]: any;
    };
    autoDelete?: boolean;
    durable?: boolean;
    exchange: string;
    internal?: boolean;
    passive?: boolean;
    type?: string;
}[]

Define any exchanges to be declared before the first publish and whenever the connection is reset. Same as Channel#exchangeDeclare()

Type declaration

  • Optional arguments?: {
        alternate-exchange?: string;
        [k: string]: any;
    }
  • Optional autoDelete?: boolean

    If set, the exchange is deleted when all queues have finished using it.

  • Optional durable?: boolean

    If set when creating a new exchange, the exchange will be marked as durable. Durable exchanges remain active when a server restarts. Non-durable exchanges (transient exchanges) are purged if/when a server restarts.

  • exchange: string

    Exchange names starting with "amq." are reserved for pre-declared and standardised exchanges. The exchange name consists of a non-empty sequence of these characters: letters, digits, hyphen, underscore, period, or colon.

  • Optional internal?: boolean

    If set, the exchange may not be used directly by publishers, but only when bound to other exchanges. Internal exchanges are used to construct wiring that is not visible to applications.

  • Optional passive?: boolean

    If set, the server will reply with Declare-Ok if the exchange already exists with the same name, and raise an error if not. The client can use this to check whether an exchange exists without modifying the server state. When set, all other method fields except name and no-wait are ignored. A declare with both passive and no-wait has no effect. Arguments are compared for semantic equivalence.

  • Optional type?: string

    direct, topic, fanout, or headers: Each exchange belongs to one of a set of exchange types implemented by the server. The exchange types define the functionality of the exchange - i.e. how messages are routed through it.

    Default

    "direct"
    
maxAttempts?: number

Maximum publish attempts. Retries are disabled by default. Increase this number to retry when a publish fails. The Connection options acquireTimeout, retryLow, and retryHigh will affect time between retries. Each failed attempt will also emit a "retry" event.

Default

1
onReturn?: ((msg) => void)

Type declaration

queueBindings?: {
    arguments?: Record<string, any>;
    exchange: string;
    queue?: string;
    routingKey?: string;
}[]

Define any queue-exchange bindings to be declared before the first publish and whenever the connection is reset. Same as Channel#queueBind()

Type declaration

  • Optional arguments?: Record<string, any>
  • exchange: string

    Name of the exchange to bind to.

  • Optional queue?: string

    Specifies the name of the queue to bind. If blank, then the last declared queue on the channel will be used.

  • Optional routingKey?: string

    Specifies the routing key for the binding. The routing key is used for routing messages depending on the exchange configuration. Not all exchanges use a routing key - refer to the specific exchange documentation. If the queue name is empty, the server uses the last queue declared on the channel. If the routing key is also empty, the server uses this queue name for the routing key as well. If the queue name is provided but the routing key is empty, the server does the binding with that empty routing key. The meaning of empty routing keys depends on the exchange implementation.

queues?: {
    arguments?: {
        x-dead-letter-exchange?: string;
        x-dead-letter-routing-key?: string;
        x-expires?: number;
        x-max-length?: number;
        x-max-priority?: number;
        x-message-ttl?: number;
        x-overflow?: "drop-head" | "reject-publish" | "reject-publish-dlx";
        x-queue-type?: "quorum" | "classic" | "stream";
        [k: string]: any;
    };
    autoDelete?: boolean;
    durable?: boolean;
    exclusive?: boolean;
    passive?: boolean;
    queue?: string;
}[]

Define any queues to be declared before the first publish and whenever the connection is reset. Same as Channel#queueDeclare()

Type declaration

  • Optional arguments?: {
        x-dead-letter-exchange?: string;
        x-dead-letter-routing-key?: string;
        x-expires?: number;
        x-max-length?: number;
        x-max-priority?: number;
        x-message-ttl?: number;
        x-overflow?: "drop-head" | "reject-publish" | "reject-publish-dlx";
        x-queue-type?: "quorum" | "classic" | "stream";
        [k: string]: any;
    }
  • Optional autoDelete?: boolean

    If set, the queue is deleted when all consumers have finished using it. The last consumer can be cancelled either explicitly or because its channel is closed. If there was no consumer ever on the queue, it won't be deleted. Applications can explicitly delete auto-delete queues using the Delete method as normal.

  • Optional durable?: boolean

    If set when creating a new queue, the queue will be marked as durable. Durable queues remain active when a server restarts. Non-durable queues (transient queues) are purged if/when a server restarts. Note that durable queues do not necessarily hold persistent messages, although it does not make sense to send persistent messages to a transient queue.

  • Optional exclusive?: boolean

    Exclusive queues may only be accessed by the current connection, and are deleted when that connection closes. Passive declaration of an exclusive queue by other connections are not allowed.

  • Optional passive?: boolean

    If set, the server will reply with Declare-Ok if the queue already exists with the same name, and raise an error if not. The client can use this to check whether a queue exists without modifying the server state. When set, all other method fields except name and no-wait are ignored. A declare with both passive and no-wait has no effect.

  • Optional queue?: string

    The queue name MAY be empty, in which case the server MUST create a new queue with a unique generated name and return this to the client in the Declare-Ok method. Queue names starting with "amq." are reserved for pre-declared and standardised queues. The queue name can be empty, or a sequence of these characters: letters, digits, hyphen, underscore, period, or colon.

Generated using TypeDoc