使用反应式扩展的事件聚合器的问题
为了链接我的 MEF 应用程序,我使用事件聚合器 在这里找到。它非常适合将数据分发到实际需要它的模块中。
我越来越多地使用反应式扩展,并且一直在尝试执行以下操作:
eventSubscription = MainApp.Events.GetEvent<UDPMessageIn>()
.BufferWithTime(TimeSpan.FromSeconds(1))
.Subscribe(x =>
{
// do something here...
});
但是,事件聚合器似乎挂在发布方法中:
((ISubject<TEvent>)subject).OnNext(sampleEvent);
我猜测 system.reactive 的设计有些问题或者我不完全理解的聚合器。有人有什么想法吗?
To link up my MEF application, I'm using the event aggregator found here. Its been perfect for distributing data into modules that actually need it.
I'm getting more into using the reactive extensions and I've been trying to do the following:
eventSubscription = MainApp.Events.GetEvent<UDPMessageIn>()
.BufferWithTime(TimeSpan.FromSeconds(1))
.Subscribe(x =>
{
// do something here...
});
However, the event aggregator appears to hang in the Publish method on:
((ISubject<TEvent>)subject).OnNext(sampleEvent);
I'm guessing that there's something about the design of either system.reactive or the aggregator that I don't fully understand. Anybody got any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
生产者和消费者都在哪些线程上运行?他们是分开的吗?
尝试:
What threads are both the producer and consumer running on? Are they separate?
Try:
事实证明这是一个与 Rx 或事件聚合器无关的线程问题。
将我的一个 UI 调用更改为 BeginInvoke 阻止了它挂起,这让我查看了正确的代码位......
It turned out to be a threading issue that was unrelated to Rx or the event aggregator.
Changing one of my UI Invokes to BeginInvoke stopped it from hanging and this got me looking at the right bits of code...