WCF 适合所有情况吗?
我正在构建一个应用程序,将其处理分布到一个农场上。 在我的基本设计中,我有两个服务:
一个“控制器”,用于监视新工作、将其排队并管理结果。
绑定到特定控制器的“worker”。 工作人员将从其控制器检查工作,并将结果推送回来。
从我在 WCF 上看到的简要来看,它似乎暗示着 MEST 风格的消息传递 SOA。 这种机制似乎与沟通和交流的类型并不相符。 协调我来做。
我是否混淆了 WCF 是什么? .NET 远程处理在这个世界上还有一席之地吗? 或者我是否以侏罗纪、WCF 之前的心态来思考这个问题。
编辑:
遗漏了一些细节。 问题是我需要对工作进行时间限制。 如果某个工作项签出时间太长,我应该能够出错整个事情。 我见过的例子似乎都对传出的消息采取“发送后忘记”的立场。 我需要在合理的时间内得到确定性的结果或错误。 希望能澄清。
I'm building an application that will distribute its processing over a farm. In my basic design I have two services:
A "controller" which watches for new work, queues it up, and manages the results.
A "worker" which binds to a particular controller. The worker will check out work from its controller, and push the results back.
In the breif look I've had at WCF, it seems to imply a MEST style message-passing SOA. This mechanism doesn't seem to jive with the types of communication & coordination I'll be doing.
Am I mixed up on what WCF is? Is there still a place in this world for .NET remoting? Or am I thinking about the problem in a jurassic, pre-WCF mindset.
Edit:
Left out some detail. The rub is that I need to timebox the work. If a workitem is checked out for too long, I should be able to error the whole thing. The examples I've seen all seem to take a "send and forget" stance towards the outgoing messages. I need a deterministic result or error in a reasonable timeframe. Hope that clarifies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不建议在大多数情况下使用远程处理; 它是不可移植的,有时管理起来有点痛苦,而且
BinaryFormatter
很脆弱(版本不宽容)。WCF 非常适合大多数情况; 如果您在农场工作,您可能希望在没有会话等的情况下运行,但无论如何我都会这样做(为了性能) - 仅使用 http 基本配置文件。
我不完全理解你所描述的场景。 当然,您始终可以使用 xml/json/binary 推出自己的 RPC - 或使用任何其他预装通信堆栈...或 MSMQ 或 BizTalk 等中间件。
重新编辑; WCF 可以同步使用(阻塞响应,(我相信)可配置的超时)。 您可以使用分布式事务等来做更复杂的事情(回滚等),但它会迅速增加复杂性。 您需要权衡停止时间等的重要性。
如果时间范围比您想要等待调用的时间长,您还可以考虑诸如工作流之类的事情 - 有一系列工作流产品,除了WF。
I don't recommend remoting for most scenarios; it is non-portable, a little painful to manage sometimes, and
BinaryFormatter
is brittle (version intolerant).WCF is a pretty good fit for most cases; if you are working on a farm you'll probably want to run without sessions etc, but I do that anyway (for performance) - just using the http basic profile.
I don't fully understand the scenario you are describing. Of course, you can always roll your own RPC using xml/json/binary - or use any of the other pre-canned comms stacks... or middleware like MSMQ or BizTalk.
Re the edit; WCF can be used synchronously (blocking on the response, with (I believe) a configurable timeout). You can do more sophisticated things (rollback etc) with distributed transactions etc, but it adds complexity rapidly. You'd need to weigh the importance of the drop-dead time, etc.
If the timeframe is longer than you'd want to wait for an invoke, you could also consider things like workflow - there are a range of workflow products around, in addition to WF.