Control how to publish a message.

interface PublishOptions {
    headers?: Map<string, any>;
    retain?: boolean;
}

Hierarchy (View Summary)

Properties

Properties

headers?: Map<string, any>

Sets headers to pass additional information with a message.

retain?: boolean

Instructs the broker to store this message on the broker as a retained message.

Unlike a regular message, a retained message remains in the broker and is delivered to new subscribers, even if they subscribe after the message has been sent.

For retained messages, the broker stores one retained message per destination (topic or capability), i.e., a later sent retained message will replace a previously sent retained message. To delete a retained message, send a retained message without payload to the same destination.

For retained requests, the broker stores all retained requests until the requestor unsubscribes.