问题描述
我试图通过利用PartitionContext在接收到事件时提供的ReceiverRuntimeInformation对象来获取最后排队的序列号,以在消费者端跟踪消费者和生产者之间的滞后.但是,ReceiverRuntimeInformation 对象没有与事件中心的特定分区相关的更新值,它返回0.示例代码和日志输出如下:
I am trying to get the last enqueued sequence number to track the lag between consumer and producer at the consumer end by leveraging ReceiverRuntimeInformation object provided by PartitionContext when a event is received. However, ReceiverRuntimeInformation object doesn't have the updated values related to that particular partition of an Event Hub, it returns 0. Sample code and log output below:
public class EventProcessor extends IEventProcessorImpl{
@Override
public void onEvents(PartitionContext context, Iterable<EventData> messages) throws Exception {
ReceiverRuntimeInformation rte = context.getRuntimeInformation();
logger.info(rte.getLastEnqueuedOffset() + " * " + rte.getLastEnqueuedSequenceNumber() + " * " + rte.getPartitionId() + " * " + rte.getRetrievalTime());
}
}
输出:
null * 0 * 3 * null
有没有办法在消费者端获取此信息?
Is there a way to get this information at the consumer end?
推荐答案
/p>
If this answer was helpful, click "Mark as Answer" or "Up-Vote". To provide additional feedback on your forum experience, clickhere
这篇关于Azure事件处理器主机Java库-ReceiverRuntimeInformation在分区上没有实际统计信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!