订阅者没有输出 [英] No Output from the Subscriber

查看:98
本文介绍了订阅者没有输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 GetPointEvent()方法对CTI事件进行排队。 T 订阅方法被调用 
面临另一个问题,我无法获得查询的输出。

当我订阅观察者时,其类型为StreamInputEvent< TpayloadType>

I am enqueing CTI event throught GetPointEvent() method. The Subscribe method gets called but am facing another issue where I am unable to get the output of the query. When I subscribe observer, its type of StreamInputEvent<TpayloadType>

 protected void PublishEvent(StreamInputEvent<TPayloadType> newEvent)
 {
   _observer.OnNext(newEvent);
 }

但是在尝试时通过接收器获取数据

But when trying to get data through sink as

//Sink to get the data after calculation
query.ToObservable().Subscribe(OnNext);

OnNext方法使用myObject类获取计算数据

OnNext method use myObject class to get calculated data

public void OnNext(myObject value)
{
 myObjectList.Add(value);
}

由于我没有得到输出,我可能错过了什么?请建议。

Anything that I might have missed due to which I am not getting the output? Please suggest.

推荐答案

根据您在其他主题中发布的内容,您不会将CTI事件排入队列。 CTI活动提前申请时间。没有它们,您将看不到任何输出,因为您的事件永远不会离开您的输入适配器/源。您可以通过
使用事件流调试器跟踪工作流来确认这一点。作为起点,您需要添加"AdvanceTimeSettings.IncreasingStartTime"和"AdvanceTimeSettings.IncreasingStartTime"。到您的ToPointStreamable()调用。这将在每个Insert事件之后排队1个CTI事件。下面的示例代码写成
将在LinqPad中使用,但经过一些修改将在常规应用程序中正常运行。

Based on what you have posted in your other thread, you are not enqueueing CTI events. CTI events advance application time. Without them, you will not see any output because your events will never leave your input adapter/source. You can confirm this by tracing the workflow with Event Flow Debugger. As a starting point, you'll want to add the "AdvanceTimeSettings.IncreasingStartTime" to your ToPointStreamable() call. This will enqueue 1 CTI event after each Insert event. The example code below was written to be used within LinqPad, but with some modifications will run just fine in a regular application.

var startTime = new DateTimeOffset(DateTime.Today);

var source = Application
	.DefineEnumerable(()=> Enumerable.Range(0, 10))
	.ToPointStreamable(e => PointEvent.CreateInsert(startTime.AddSeconds(e), e),
	AdvanceTimeSettings.IncreasingStartTime);

var query = from e in source
	where e % 2 == 0
	select e;

query.ToObservable().Subscribe((e)=> e.Dump());





这篇关于订阅者没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆