Prism事件聚合器持久性事件 [英] Prism event aggregator Persistent Events

查看:200
本文介绍了Prism事件聚合器持久性事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的服务器上实现了Prism事件聚合器,其中服务发布一个事件,另一个监听它。
我的订阅代码:

  my_aggregator.GetEvent< MyEvent>()。订阅(Handler,true) 

而我将我的活动发布为:

  my_aggregator.GetEvent< MyEvent>()出版(有效载荷); 





事实是,如果订阅者还活着,一切都很好。但是,让我们说一个事件被发布,订户(是一个服务)以某种方式关闭。有没有一种方式,当用户再次活着时,它可以响应被触发的事件。



我已经看过netmsmq绑定,以及它如何在服务之间提供一个队列,所以即使服务器关闭数据丢失也可以避免。



我必须用我目前的机制挂钩吗?
还有其他方法可以实现吗?
有什么标准的机制来处理吗?



编辑:如果您可以提供一个链接/ code>

解决方案

您正在寻找一个存储和转发机制。几年前,我使用了本文 Ade Miller 完成同样的事情。然而,我对Prism几年没有做太多,这篇文章大约是2008年,所以在描述的方法可能仍然适用的时候,实际的实现可能与新版本的棱镜...


I have implemented Prism event Aggregators on my server where a service publishes an event and another one listens to it. My subscription code:

 my_aggregator.GetEvent<MyEvent>().Subscribe(Handler,true);

whereas I publish my event as:

my_aggregator.GetEvent<MyEvent>().Publish(Payload);

The thing is that if the subscriber is alive then, everything works fine. But, lets say an event is published and the subscriber (is a service) somehow shuts down. Is there a way by which when the subscriber comes alive again it can respond to the event that was fired.

I have looked at netmsmq binding and how it provides a queue between services so even if the server shuts down loss of data can be avoided.

Will I have to hook it up with my current mechanism?? Or is there any other way this can be achieved?? And are there any standard mechanisms of handling this?

Edit: It would be very much helpful if you can provide a link/code snippet that describes a path that can be taken to achieve this.

解决方案

You are looking for a "store and forward" mechanism. Some years ago, I used the method described in this article by Ade Miller to accomplish the same thing. However, I have not done much with Prism for a few years and this article is circa 2008, so while the method described would probably still be applicable, the actual implementation might not be the same for newer versions of Prism...

这篇关于Prism事件聚合器持久性事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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