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()); } }
Output:
null * 0 * 3 * null
Is there a way to get this information at the consumer end?