MessageEnumerator::RemoveCurrent Method (MessageQueueTransaction^)
Removes the current message from a transactional queue and returns the message to the calling application. There is no timeout specified for a message to arrive in the queue.
Assembly: System.Messaging (in System.Messaging.dll)
Parameters
- transaction
-
Type:
System.Messaging::MessageQueueTransaction^
The MessageQueueTransaction object that specifies the transaction in which the message will be removed.
Return Value
Type: System.Messaging::Message^A Message that references the first message available in the queue.
| Exception | Condition |
|---|---|
| ArgumentNullException | The transaction parameter is null. |
RemoveCurrent removes and returns the message at the cursor's current location, using the internal transaction context defined by the transaction parameter.
If you are using queue journaling, removing the message causes a copy to be kept in the journal queue, just as the MessageQueue class's Receive method does.
When working with transactional queues, a rollback of a transaction causes any messages removed by a call to RemoveCurrent to be returned to the queue. The removal is not irreversible until the transaction is committed.
When you remove the current message, the cursor is moved to the next message. You do not have to call MoveNext after calling RemoveCurrent.
Available since 1.1