你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
EventHubConsumerGroup.CreateReceiverAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
CreateReceiverAsync(String, String, Boolean, Int64, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, string startingOffset, bool offsetInclusive, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * string * bool * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, startingOffset As String, offsetInclusive As Boolean, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- startingOffset
- String
开始接收消息的起始偏移量。
- offsetInclusive
- Boolean
一个布尔值,该值指示是否 startingOffset
被视为非独占偏移量,这意味着返回的第一个事件是包含起始偏移量的事件。 通常,返回的第一个事件是起始偏移量之后的事件。
- epoch
- Int64
epoch 值。 服务使用此值来强制实施分区/租约所有权。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
适用于
CreateReceiverAsync(String, String, Int64, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, string startingOffset, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * string * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, startingOffset As String, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- startingOffset
- String
开始接收消息的起始偏移量。 若要指定流的开始,请参阅 StartOfStream。
- epoch
- Int64
epoch 值。 服务使用此值来强制实施分区/租约所有权。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
适用于
CreateReceiverAsync(String, String, Boolean, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, string startingOffset, bool offsetInclusive, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * string * bool * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, startingOffset As String, offsetInclusive As Boolean, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- startingOffset
- String
开始接收消息的起始偏移量。
- offsetInclusive
- Boolean
一个布尔值,该值指示是否 startingOffset
被视为非独占偏移量,这意味着返回的第一个事件是包含起始偏移量的事件。 通常,返回的第一个事件是起始偏移量之后的事件。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
适用于
CreateReceiverAsync(String, DateTime, Int64, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, DateTime startingDateTimeUtc, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * DateTime * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, startingDateTimeUtc As DateTime, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- startingDateTimeUtc
- DateTime
接收消息的开始 UTC 时间。
- epoch
- Int64
epoch 值。 服务使用此值来强制实施分区/租约所有权。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
注解
服务仅在确定下一个要传递的事件时将其 startingDateTimeUtc
用作近似值。
请记住,客户端时间和服务时间之间可能存在时钟偏差,因此应将用户应用程序设计为处理事件传递中的重复。
适用于
CreateReceiverAsync(String, DateTime, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, DateTime startingDateTimeUtc, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * DateTime * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, startingDateTimeUtc As DateTime, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- startingDateTimeUtc
- DateTime
接收消息的开始 UTC 时间。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
注解
服务仅在确定下一个要传递的事件时将其 startingDateTimeUtc
用作近似值。
请记住,客户端时间和服务时间之间可能存在时钟偏差,因此应将用户应用程序设计为处理事件传递中的重复。
适用于
CreateReceiverAsync(String, String, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, string startingOffset, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * string * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, startingOffset As String, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- startingOffset
- String
开始接收消息的起始偏移量。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
适用于
CreateReceiverAsync(String, Int64, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, long epoch, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * int64 * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, epoch As Long, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- epoch
- Int64
epoch 值。 服务使用此值来强制实施分区/租约所有权。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
注解
EventHubConsumerGroup如果 已启用检查点,则接收方将从检查点偏移中获取下一条消息。 如果禁用了检查点,则接收方将从事件流的开头获取消息,由事件中心的消息保留策略确定。
适用于
CreateReceiverAsync(String, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。
注解
EventHubConsumerGroup如果 启用了检查点,则此重载将始终引发 InvalidOperationException,因为启用了检查点的 ConsumerGroup 需要 epoch 才能正常工作 (请使用提供 epoch 的重载作为输入参数) 。 如果禁用了检查点,则接收方将从事件流的开头获取消息,由事件中心的消息保留策略确定。
适用于
CreateReceiverAsync(String, EventPosition, Nullable<Int64>, ReceiverOptions)
public System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver> CreateReceiverAsync (string partitionId, Microsoft.ServiceBus.Messaging.EventPosition position, long? epoch = default, Microsoft.ServiceBus.Messaging.ReceiverOptions receiverOptions = default);
member this.CreateReceiverAsync : string * Microsoft.ServiceBus.Messaging.EventPosition * Nullable<int64> * Microsoft.ServiceBus.Messaging.ReceiverOptions -> System.Threading.Tasks.Task<Microsoft.ServiceBus.Messaging.EventHubReceiver>
Public Function CreateReceiverAsync (partitionId As String, position As EventPosition, Optional epoch As Nullable(Of Long) = Nothing, Optional receiverOptions As ReceiverOptions = Nothing) As Task(Of EventHubReceiver)
参数
- partitionId
- String
分区的 ID。
- position
- EventPosition
EventPosition开始接收消息的起始时间。
- receiverOptions
- ReceiverOptions
事件中心接收器的选项。
返回
返回 Task<TResult>。