在 WCF 或 .Net Remoting 中调度通用任务
我断断续续地研究了几天,但尚未找出实现以下目标的最佳方法。
我想在 C# 中定义一个接口或抽象类,它有一个关联的 Run 方法,类似于 Java 可运行接口。目标是拥有一个包含这些对象列表的共享队列。然后,各个客户端将能够派生自己的具体可运行类并将它们添加到服务器托管的队列中。客户端还可以将这些可运行对象从队列中弹出并任意执行它们。
这似乎在基于虚拟机的语言中是可行的,而不需要将任何具体实现放在共享程序集中,但到目前为止我还没有找到这样一个系统的工作示例。
有谁知道如何实现这一目标?
I've been researching for a couple days on and off, and have yet to figure out the best way to achieve the following goal.
I would like to define either an interface or abstract class in C# which has an associated Run method, similar to the Java runnable interface. The goal would be to have a shared queue which contains a list of these objects. Then individual clients would be able to derive their own concrete runnable classes and add them to the queue hosted by the server. Clients would also be able to pop these runnable objects off the queue and execute them arbitrarily.
This seems like it should be feasible in a VM based language without needing to place any of the concrete implementations in a shared assembly, but I have thus far had no luck finding a working example of such a system.
Does anyone know how this might be achieved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想查看 Agatha 项目。它为 WCF 提供了一个简单的请求/响应层。至于添加新的“运行”实现,您将使用 IoC 容器或 MEF 来注册新端点。
You might want to check out the Agatha project. It provides a simple request/response layer for WCF. As far as adding new "Run" implementations, you would use an IoC container or MEF to register new endpoints.