MessageReceiver.ReceiveAsync Method

Definition

Overloads

ReceiveAsync()

Receive a message from the entity defined by Path using ReceiveMode mode.

ReceiveAsync(Int32)

Receives a maximum of maxMessageCount messages from the entity defined by Path using ReceiveMode mode.

ReceiveAsync(TimeSpan)

Receive a message from the entity defined by Path using ReceiveMode mode.

ReceiveAsync(Int32, TimeSpan)

Receives a maximum of maxMessageCount messages from the entity defined by Path using ReceiveMode mode.

ReceiveAsync()

Source:
MessageReceiver.cs

Receive a message from the entity defined by Path using ReceiveMode mode.

public System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Message> ReceiveAsync ();
abstract member ReceiveAsync : unit -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Message>
override this.ReceiveAsync : unit -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Message>
Public Function ReceiveAsync () As Task(Of Message)

Returns

The message received. Returns null if no message is found.

Implements

Remarks

Operation will time out after duration of OperationTimeout

Applies to

ReceiveAsync(Int32)

Source:
MessageReceiver.cs

Receives a maximum of maxMessageCount messages from the entity defined by Path using ReceiveMode mode.

public System.Threading.Tasks.Task<System.Collections.Generic.IList<Microsoft.Azure.ServiceBus.Message>> ReceiveAsync (int maxMessageCount);
abstract member ReceiveAsync : int -> System.Threading.Tasks.Task<System.Collections.Generic.IList<Microsoft.Azure.ServiceBus.Message>>
override this.ReceiveAsync : int -> System.Threading.Tasks.Task<System.Collections.Generic.IList<Microsoft.Azure.ServiceBus.Message>>
Public Function ReceiveAsync (maxMessageCount As Integer) As Task(Of IList(Of Message))

Parameters

maxMessageCount
Int32

The maximum number of messages that will be received.

Returns

List of messages received. Returns null if no message is found.

Implements

Remarks

Receiving less than maxMessageCount messages is not an indication of empty entity.

Applies to

ReceiveAsync(TimeSpan)

Source:
MessageReceiver.cs

Receive a message from the entity defined by Path using ReceiveMode mode.

public System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Message> ReceiveAsync (TimeSpan operationTimeout);
abstract member ReceiveAsync : TimeSpan -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Message>
override this.ReceiveAsync : TimeSpan -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Message>
Public Function ReceiveAsync (operationTimeout As TimeSpan) As Task(Of Message)

Parameters

operationTimeout
TimeSpan

The time span the client waits for receiving a message before it times out.

Returns

The message received. Returns null if no message is found.

Implements

Remarks

The parameter operationTimeout includes the time taken by the receiver to establish a connection (either during the first receive or when connection needs to be re-established). If establishing the connection times out, this will throw ServiceBusTimeoutException.

Applies to

ReceiveAsync(Int32, TimeSpan)

Source:
MessageReceiver.cs

Receives a maximum of maxMessageCount messages from the entity defined by Path using ReceiveMode mode.

public System.Threading.Tasks.Task<System.Collections.Generic.IList<Microsoft.Azure.ServiceBus.Message>> ReceiveAsync (int maxMessageCount, TimeSpan operationTimeout);
abstract member ReceiveAsync : int * TimeSpan -> System.Threading.Tasks.Task<System.Collections.Generic.IList<Microsoft.Azure.ServiceBus.Message>>
override this.ReceiveAsync : int * TimeSpan -> System.Threading.Tasks.Task<System.Collections.Generic.IList<Microsoft.Azure.ServiceBus.Message>>
Public Function ReceiveAsync (maxMessageCount As Integer, operationTimeout As TimeSpan) As Task(Of IList(Of Message))

Parameters

maxMessageCount
Int32

The maximum number of messages that will be received.

operationTimeout
TimeSpan

The time span the client waits for receiving a message before it times out.

Returns

List of messages received. Returns null if no message is found.

Implements

Remarks

Receiving less than maxMessageCount messages is not an indication of empty entity. The parameter operationTimeout includes the time taken by the receiver to establish a connection (either during the first receive or when connection needs to be re-established). If establishing the connection times out, this will throw ServiceBusTimeoutException.

Applies to