IMessageReceiver.ReceiveAsync Method

Definition

Overloads

ReceiveAsync()

Receive a message from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.Path using ReceiveMode mode.

ReceiveAsync(Int32)

Receives a maximum of maxMessageCount messages from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.Path using ReceiveMode mode.

ReceiveAsync(TimeSpan)

Receive a message from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.Path using ReceiveMode mode.

ReceiveAsync(Int32, TimeSpan)

Receives a maximum of maxMessageCount messages from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.Path using ReceiveMode mode.

ReceiveAsync()

Receive a message from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.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>
Public Function ReceiveAsync () As Task(Of Message)

Returns

System.Threading.Tasks.Task<Message>

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

Remarks

Operation will time out after duration of OperationTimeout

Applies to

ReceiveAsync(Int32)

Receives a maximum of maxMessageCount messages from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.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>>
Public Function ReceiveAsync (maxMessageCount As Integer) As Task(Of IList(Of Message))

Parameters

maxMessageCount
System.Int32

The maximum number of messages that will be received.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.IList<Message>>

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

Remarks

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

Applies to

ReceiveAsync(TimeSpan)

Receive a message from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.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>
Public Function ReceiveAsync (operationTimeout As TimeSpan) As Task(Of Message)

Parameters

serverWaitTime
System.TimeSpan

Returns

System.Threading.Tasks.Task<Message>

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

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)

Receives a maximum of maxMessageCount messages from the entity defined by Microsoft.Azure.ServiceBus.Core.IReceiverClient.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>>
Public Function ReceiveAsync (maxMessageCount As Integer, operationTimeout As TimeSpan) As Task(Of IList(Of Message))

Parameters

maxMessageCount
System.Int32

The maximum number of messages that will be received.

serverWaitTime
System.TimeSpan

Returns

System.Threading.Tasks.Task<System.Collections.Generic.IList<Message>>

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

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