MessageEnumerator.RemoveCurrent MessageEnumerator.RemoveCurrent MessageEnumerator.RemoveCurrent MessageEnumerator.RemoveCurrent Method

Definition

Removes the current message from the queue and returns the message to the calling application. Removing the message deletes it from the queue.

Overloads

RemoveCurrent() RemoveCurrent() RemoveCurrent() RemoveCurrent()

Removes the current message from a transactional or non-transactional queue and returns the message to the calling application. There is no timeout specified for a message to arrive in the queue.

RemoveCurrent(MessageQueueTransaction) RemoveCurrent(MessageQueueTransaction) RemoveCurrent(MessageQueueTransaction) RemoveCurrent(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.

RemoveCurrent(MessageQueueTransactionType) RemoveCurrent(MessageQueueTransactionType) RemoveCurrent(MessageQueueTransactionType) RemoveCurrent(MessageQueueTransactionType)

Removes the current message from a queue and returns the message to the calling application. There is no timeout specified for a message to arrive in the queue.

RemoveCurrent(TimeSpan) RemoveCurrent(TimeSpan) RemoveCurrent(TimeSpan) RemoveCurrent(TimeSpan)

Removes the current message from the queue and returns the message to the calling application. If there is a message to remove, the method returns it immediately. Otherwise, the method waits the specified timeout for a new message to arrive.

RemoveCurrent(TimeSpan, MessageQueueTransaction) RemoveCurrent(TimeSpan, MessageQueueTransaction) RemoveCurrent(TimeSpan, MessageQueueTransaction) RemoveCurrent(TimeSpan, MessageQueueTransaction)

Removes the current message from a transactional queue and returns the message to the calling application. If there is a message to remove, the method returns it immediately. Otherwise, the method waits the specified timeout for a new message to arrive.

RemoveCurrent(TimeSpan, MessageQueueTransactionType) RemoveCurrent(TimeSpan, MessageQueueTransactionType) RemoveCurrent(TimeSpan, MessageQueueTransactionType) RemoveCurrent(TimeSpan, MessageQueueTransactionType)

Removes the current message from a queue and returns the message to the calling application. If there is a message to remove, the method returns it immediately. Otherwise, the method waits the specified timeout for a new message to arrive.

Remarks

The behavior described for these overloads is applicable only if the MessageEnumerator instance is retrieved by using the GetMessageEnumerator2. Do not use GetMessageEnumerator to retrieve an instance of MessageEnumerator as this method has been deprecated.

RemoveCurrent() RemoveCurrent() RemoveCurrent() RemoveCurrent()

Removes the current message from a transactional or non-transactional queue and returns the message to the calling application. There is no timeout specified for a message to arrive in the queue.

public:
 System::Messaging::Message ^ RemoveCurrent();
public System.Messaging.Message RemoveCurrent ();
member this.RemoveCurrent : unit -> System.Messaging.Message
Public Function RemoveCurrent () As Message

Returns

A Message that references the first message available in the queue.

Remarks

RemoveCurrent removes and returns the message at the cursor's current location.

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 you remove the current message, the cursor is moved to the next message. You do not have to call MoveNext after calling RemoveCurrent.

If you call this overload on a transactional queue, Message Queuing creates a single internal transaction.

See also

RemoveCurrent(MessageQueueTransaction) RemoveCurrent(MessageQueueTransaction) RemoveCurrent(MessageQueueTransaction) RemoveCurrent(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.

public:
 System::Messaging::Message ^ RemoveCurrent(System::Messaging::MessageQueueTransaction ^ transaction);
public System.Messaging.Message RemoveCurrent (System.Messaging.MessageQueueTransaction transaction);
member this.RemoveCurrent : System.Messaging.MessageQueueTransaction -> System.Messaging.Message
Public Function RemoveCurrent (transaction As MessageQueueTransaction) As Message

Parameters

transaction
MessageQueueTransaction MessageQueueTransaction MessageQueueTransaction MessageQueueTransaction

The MessageQueueTransaction object that specifies the transaction in which the message will be removed.

Returns

A Message that references the first message available in the queue.

Exceptions

Remarks

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.

See also

RemoveCurrent(MessageQueueTransactionType) RemoveCurrent(MessageQueueTransactionType) RemoveCurrent(MessageQueueTransactionType) RemoveCurrent(MessageQueueTransactionType)

Removes the current message from a queue and returns the message to the calling application. There is no timeout specified for a message to arrive in the queue.

public:
 System::Messaging::Message ^ RemoveCurrent(System::Messaging::MessageQueueTransactionType transactionType);
public System.Messaging.Message RemoveCurrent (System.Messaging.MessageQueueTransactionType transactionType);
member this.RemoveCurrent : System.Messaging.MessageQueueTransactionType -> System.Messaging.Message
Public Function RemoveCurrent (transactionType As MessageQueueTransactionType) As Message

Parameters

transactionType
MessageQueueTransactionType MessageQueueTransactionType MessageQueueTransactionType MessageQueueTransactionType

One of the MessageQueueTransactionType values, describing the type of transaction context to associate with the message.

Returns

A Message that references the first message available in the queue.

Exceptions

Remarks

RemoveCurrent removes and returns the message at the cursor's current location, using a transaction context defined by the transactionType parameter.

Specify Automatic for the transactionType parameter if there is already an external transaction context attached to the thread that you want to use to receive the message. Specify Single if you want to receive the message as a single internal transaction. You can specify None if you want to receive a message from a transactional queue outside of a transaction context.

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.

See also

RemoveCurrent(TimeSpan) RemoveCurrent(TimeSpan) RemoveCurrent(TimeSpan) RemoveCurrent(TimeSpan)

Removes the current message from the queue and returns the message to the calling application. If there is a message to remove, the method returns it immediately. Otherwise, the method waits the specified timeout for a new message to arrive.

public:
 System::Messaging::Message ^ RemoveCurrent(TimeSpan timeout);
public System.Messaging.Message RemoveCurrent (TimeSpan timeout);
member this.RemoveCurrent : TimeSpan -> System.Messaging.Message
Public Function RemoveCurrent (timeout As TimeSpan) As Message

Parameters

timeout
TimeSpan TimeSpan TimeSpan TimeSpan

The interval of time to wait for a message to arrive in the queue.

Returns

A Message that references the first message available in the queue.

Exceptions

The value specified for the timeout parameter is invalid.

Remarks

RemoveCurrent removes and returns the message at the cursor's current location. If the cursor is at the end of the queue, this overload of the method waits until a message is available or the interval specified by the timeout parameter has expired.

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 you remove the current message, the cursor is moved to the next message. You do not have to call MoveNext after calling RemoveCurrent.

If you call this overload on a transactional queue, Message Queuing creates a single internal transaction.

See also

RemoveCurrent(TimeSpan, MessageQueueTransaction) RemoveCurrent(TimeSpan, MessageQueueTransaction) RemoveCurrent(TimeSpan, MessageQueueTransaction) RemoveCurrent(TimeSpan, MessageQueueTransaction)

Removes the current message from a transactional queue and returns the message to the calling application. If there is a message to remove, the method returns it immediately. Otherwise, the method waits the specified timeout for a new message to arrive.

public:
 System::Messaging::Message ^ RemoveCurrent(TimeSpan timeout, System::Messaging::MessageQueueTransaction ^ transaction);
public System.Messaging.Message RemoveCurrent (TimeSpan timeout, System.Messaging.MessageQueueTransaction transaction);
member this.RemoveCurrent : TimeSpan * System.Messaging.MessageQueueTransaction -> System.Messaging.Message
Public Function RemoveCurrent (timeout As TimeSpan, transaction As MessageQueueTransaction) As Message

Parameters

timeout
TimeSpan TimeSpan TimeSpan TimeSpan

The interval of time to wait for the message to be removed.

transaction
MessageQueueTransaction MessageQueueTransaction MessageQueueTransaction MessageQueueTransaction

The MessageQueueTransaction object that specifies the transaction context for the message.

Returns

A Message that references the first message available in the queue.

Exceptions

The value specified for the timeout parameter is invalid.

Remarks

RemoveCurrent removes and returns the message at the cursor's current location. If the cursor is at the end of the queue, this overload of the method waits until a message is available or the interval specified by the timeout parameter has expired.

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.

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 you remove the current message, the cursor is moved to the next message. You do not have to call MoveNext after calling RemoveCurrent.

See also

RemoveCurrent(TimeSpan, MessageQueueTransactionType) RemoveCurrent(TimeSpan, MessageQueueTransactionType) RemoveCurrent(TimeSpan, MessageQueueTransactionType) RemoveCurrent(TimeSpan, MessageQueueTransactionType)

Removes the current message from a queue and returns the message to the calling application. If there is a message to remove, the method returns it immediately. Otherwise, the method waits the specified timeout for a new message to arrive.

public:
 System::Messaging::Message ^ RemoveCurrent(TimeSpan timeout, System::Messaging::MessageQueueTransactionType transactionType);
public System.Messaging.Message RemoveCurrent (TimeSpan timeout, System.Messaging.MessageQueueTransactionType transactionType);
member this.RemoveCurrent : TimeSpan * System.Messaging.MessageQueueTransactionType -> System.Messaging.Message
Public Function RemoveCurrent (timeout As TimeSpan, transactionType As MessageQueueTransactionType) As Message

Parameters

timeout
TimeSpan TimeSpan TimeSpan TimeSpan

The interval of time to wait for the message to be removed.

transactionType
MessageQueueTransactionType MessageQueueTransactionType MessageQueueTransactionType MessageQueueTransactionType

One of the MessageQueueTransactionType values, describing the type of transaction context to associate with the message.

Returns

A Message that references the first message available in the queue.

Exceptions

The value specified for the timeout parameter is invalid.

Remarks

RemoveCurrent removes and returns the message at the cursor's current location, using a transaction context defined by the transactionType parameter. If the cursor is at the end of the queue, this overload of the method waits until a message is available or the interval specified by the timeout parameter has expired.

Specify Automatic for the transactionType parameter if there is already an external transaction context attached to the thread that you want to use to receive the message. Specify Single if you want to receive the message as a single internal transaction. You can specify None if you want to receive a message from a transactional queue outside of a transaction context.

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.

See also

Applies to