Background

Delivering messages from the server destination to a message consumer involves two independent phases—fetch and accept.

  • The fetch phase is a two-step interaction between a message consumer and the server.
    • The message consumer initiates the fetch phase by signaling to the server that it is ready for more messages.
    • The server responds by transferring one or more messages to the client, which stores them in the message consumer.
  • In the accept phase, client code takes a message from the message consumer.

The receive call embraces both of these phases. It initiates fetch when needed and it accepts a message from the message consumer.

To reduce waiting time for client programs, the message consumer can prefetch messages—that is, fetch a batch of messages from the server, and hold them for client code to accept, one by one.