Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure IEventProcessor-设置偏移量_Azure_Azure Eventhub - Fatal编程技术网

Azure IEventProcessor-设置偏移量

Azure IEventProcessor-设置偏移量,azure,azure-eventhub,Azure,Azure Eventhub,我们使用的是一个使用iterface IEventProcessor的均衡器处理器。 当我连接到Azure Eventhub时,我总是获得“所有”数据,但我只想要“实时”数据。我正在读关于设置偏移量的书,使用日期时间,但我不知道在哪里。一直在尝试,但没有成功。可能吗?附上以下部分代码: 问候 public class EventProcessor : IEventProcessor { IDictionary<string, int> map; Par

我们使用的是一个使用iterface IEventProcessor的均衡器处理器。 当我连接到Azure Eventhub时,我总是获得“所有”数据,但我只想要“实时”数据。我正在读关于设置偏移量的书,使用日期时间,但我不知道在哪里。一直在尝试,但没有成功。可能吗?附上以下部分代码: 问候

    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(空);
}