我们正在使用使用 iterface IEventProcessor 的 EvenProcessor。当我连接到我们的 Azure Eventhub 时,我总是得到“所有”数据,但我只想要“实时”数据。正在阅读有关使用 DateTime 设置偏移量的信息,但我不知道在哪里。一直在尝试没有和成功。可能吗?附上下面的一些代码:问候
public class EventProcessor : IEventProcessor
{
IDictionary<string, int> map;
PartitionContext partitionContext;
Stopwatch checkpointStopWatch;
public EventProcessor()
{
this.map = new Dictionary<string, int>();
}
public Task OpenAsync(PartitionContext context)
{
context.Lease.Offset = DateTime.Now.ToString(); // not working - still gives all data
this.partitionContext = context;
this.checkpointStopWatch = new Stopwatch();
this.checkpointStopWatch.Start();
return Task.FromResult<object>(null);
}