An undeliverable message was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information about the reason that the message was undeliverable.
See maxAttempts. Emitted each time a failed publish will be retried.
This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration.
If the body is a string then it will be serialized with contentType='text/plain'. If body is an object then it will be serialized with contentType='application/json'. Buffer objects are unchanged.
If publisher-confirms are enabled, then this will resolve when the acknowledgement is received. Otherwise this will resolve after writing to the TCP socket, which is usually immediate. Note that if you keep publishing while the connection is blocked (see :BLOCKED | Connection#on('connection.blocked')) then the TCP socket buffer will eventually fill and this method will no longer resolve immediately.
Send directly to a queue. Same as send({routingKey: queue}, body)
See
Connection#createPublisher()
The underlying Channel is lazily created the first time a message is published.
Example