Este conteúdo não está disponível no idioma selecionado.
Chapter 9. Message delivery
9.1. Sending messages Copiar o linkLink copiado para a área de transferência!
To send a message, override the on_sendable event handler and call the sender::send() method. The sendable event fires when the proton::sender has enough credit to send at least one message.
Example: Sending messages
9.2. Tracking sent messages Copiar o linkLink copiado para a área de transferência!
When a message is sent, the sender can keep a reference to the tracker object representing the transfer. The receiver accepts or rejects each message that is delivered. The sender is notified of the outcome for each tracked delivery.
To monitor the outcome of a sent message, override the on_tracker_accept and on_tracker_reject event handlers and map the delivery state update to the tracker returned from send().
Example: Tracking sent messages
The tracker object has a tag() method for accessing the unique identifier for each delivery. The delivery tag can be used to store in-flight messages for resending after a connection failure.
9.3. Receiving messages Copiar o linkLink copiado para a área de transferência!
To receive messages, create a receiver and override the on_message event handler.
Example: Receiving messages
The delivery object has a tag() method for accessing the unique identifier for each delivery.
9.4. Acknowledging received messages Copiar o linkLink copiado para a área de transferência!
To explicitly accept or reject a delivery, use the delivery::accept() or delivery::reject() methods in the on_message event handler.
Example: Acknowledging received messages
By default, if you do not explicitly acknowledge a delivery, then the library accepts it after on_message returns. To disable this behavior, set the auto_accept receiver option to false.