Synchronous Reading
Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista
When an application synchronously reads messages in a queue, all calls are blocked until the next message is available or a specific amount of time expires. The amount of time the application waits can be 0, a specific amount of time (in milliseconds), or the maximum time allowed by your Message Queuing enterprise. When the time expires for a synchronous read, Message Queuing returns a NULL message (for applications using COM components) or an MQ_ERROR_IO_TIMEOUT error (for applications using functions).
Note
Cursors can be used to navigate through a queue when reading messages synchronously. Cursors behave the same way in synchronous and asynchronous operations.
For information on | See |
---|---|
Asynchronous operations | Asynchronous Reading |
Leaving a message when it is read | Peeking at Messages |
Removing a message when it is read | Retrieving Messages |
Reading past the first message in the queue | Navigating with Cursors |
How transactions work and the different types of transactions | Transactions |
Reading the first message in the queue synchronously | C/C++ Code Example: Reading Messages Synchronously C/C++ COM Code Example: Reading Messages Synchronously Visual Basic Code Example: Reading Messages Synchronously |
Reading messages asynchronously | C/C++ Code Example: Reading Messages Asynchronously Using a Callback Function C/C++ Code Example: Reading Messages Asynchronously Using Completion Ports C/C++ COM Code Example: Reading Messages Asynchronously Visual Basic Code Example: Reading Messages Asynchronously |