Azure IEventProcessor-设置偏移量
我们使用的是一个使用iterface IEventProcessor的均衡器处理器。 当我连接到Azure Eventhub时,我总是获得“所有”数据,但我只想要“实时”数据。我正在读关于设置偏移量的书,使用日期时间,但我不知道在哪里。一直在尝试,但没有成功。可能吗?附上以下部分代码: 问候Azure IEventProcessor-设置偏移量,azure,azure-eventhub,Azure,Azure Eventhub,我们使用的是一个使用iterface IEventProcessor的均衡器处理器。 当我连接到Azure Eventhub时,我总是获得“所有”数据,但我只想要“实时”数据。我正在读关于设置偏移量的书,使用日期时间,但我不知道在哪里。一直在尝试,但没有成功。可能吗?附上以下部分代码: 问候 public class EventProcessor : IEventProcessor { IDictionary<string, int> map; Par
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);
}
公共类事件处理器:IEventProcessor
{
词典地图;
PartitionContext PartitionContext;
秒表;秒表;
公共事件处理器()
{
this.map=新字典();
}
公共任务OpenAsync(PartitionContext上下文)
{
context.Lease.Offset=DateTime.Now.ToString();//不工作-仍然提供所有数据
this.partitionContext=上下文;
this.checkpointStopWatch=新秒表();
这个.checkpointStopWatch.Start();
返回Task.FromResult(空);
}