IMessageReceiver.ReceiveAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ReceiveAsync() |
Receive a message from the entity defined by Path using ReceiveMode mode. |
ReceiveAsync(Int32) |
Receives a maximum of |
ReceiveAsync(TimeSpan) |
Receive a message from the entity defined by Path using ReceiveMode mode. |
ReceiveAsync(Int32, TimeSpan) |
Receives a maximum of |
ReceiveAsync()
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>
Public Function ReceiveAsync () As Task(Of Message)
Returns
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 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
- Int32
The maximum number of messages that will be received.
Returns
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 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
- 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.
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 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
- 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.
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
Azure SDK for .NET