Share via


Retrieve Method

Retrieves the first message from the message buffer.

Namespace:  Microsoft.ServiceBus
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)

Syntax

'Declaration
Public Function Retrieve As Message
'Usage
Dim instance As MessageBufferClient
Dim returnValue As Message

returnValue = instance.Retrieve()
public Message Retrieve()
public:
Message^ Retrieve()
member Retrieve : unit -> Message 
public function Retrieve() : Message

Return Value

Type: System.ServiceModel.Channels. . :: . .Message
Returns a Message that contains the message.

Remarks

This method retrieves the first message from the message buffer, and deletes that message from the message buffer.

If the buffer does not return a message within the timeout value, the method returns a TimeoutException. This likely indicates that there were no messages in the buffer to send. The default value is one minute.

Examples

The following code example describes how to call a destructive read on the message buffer.

// Retrieve a message (destructive read)
message = client.Retrieve();
content = message.GetBody<string>();
message.Close();

See Also

Reference

MessageBufferClient Class

Retrieve Overload

Microsoft.ServiceBus Namespace