简体   繁体   English

与客户端端点对话的Workflow Service自定义跟踪参与者?

[英]Workflow Service custom tracking participant that talks to a client-side endpoint(s)?

I'm at the investigative stage for Workflow Service and WPF. 我正处于工作流程服务和WPF的调查阶段。

Having State Machine WF Service hosted in IIS and one or more WPF clients talking to the WF Service sounds reasonable choice so far. 到目前为止,让State Machine WF Service托管在IIS中以及一个或多个WPF客户端与WF Service进行通信听起来是合理的选择。

However, although days of reading and research it isn't clear to me what would be the best strategy for tracking the transfer between states from WPF app. 但是,尽管经过数天的阅读和研究,对我来说仍不清楚什么是从WPF应用程序跟踪状态之间转移的最佳策略。

There're numerous samples of tracking participants but most of them are based on One process scenario. 跟踪参与者的样本很多,但其中大多数是基于“一个流程”场景的。

So I am thinking of a structure as below. 因此,我正在考虑以下结构。

  1. A server-side WCF operation that any client calls to register its client-side endpoint 任何客户端调用以注册其客户端端点的服务器端WCF操作
  2. A custom tracking participant that goes through all registered client-side endpoints and sends TrackingRecord at it's Track() method. 一个定制的跟踪参与者,它会遍历所有已注册的客户端端点,并通过其Track()方法发送TrackingRecord。

Advantage of this approach is that it allows real time update of the states without extra layers like ETW. 这种方法的优势在于,它可以实时更新状态,而无需像ETW这样的额外层。 Another advantage is that it allows decoupling of the logic (or maybe model layer) from the presentation layer. 另一个优点是它允许将逻辑(或模型层)与表示层解耦。

Can anyone share the opinion over the above structure? 任何人都可以对以上结构发表意见吗? I would also welcome any suggestions for achieving the goal. 我也欢迎实现目标的任何建议。


[EDIT] To make my idea above more detailed and clear, below steps would be a typical usage. [编辑]为了使我的想法更加详细和清楚,以下步骤是一种典型用法。

1) (WPF client) contains and opens a WCF endpoint for receiving TrackRecords. 1)(WPF客户端)包含并打开一个WCF端点以接收TrackRecords。

2) (WF Service) opens a WCF operation (or a simple WF instance with a Receive message) that registers client-side address to an internal store. 2)(WF服务)打开WCF操作(或带有接收消息的简单WF实例),该操作将客户端地址注册到内部存储中。

3) (WF Service) a custom tracking participant is created and added that will send TrackingRecord to the registered clients' endpoints. 3)(WF服务)创建并添加了一个自定义跟踪参与者,该参与者会将TrackingRecord发送到已注册客户端的端点。

4) (client) connects to the above service and hands out client-side endpoint mentioned at step 1 and consequently receives TrackingRecords. 4)(客户端)连接到上述服务,并分发在步骤1中提到的客户端端点,因此接收TrackingRecords。


[ EDIT 2 ] [编辑2]

To put my goal in simple terms, I'd like to know 简单来说,我的目标是

1) the most efficient way of tracking the StateMachine's state on a WF Service (IIS) + WPF or any types of client app through TrackingParticipant. 1)通过TrackingParticipant在WF服务(IIS)+ WPF或任何类型的客户端应用上跟踪StateMachine状态的最有效方法。

2) if my suggestion can be improved 2)如果我的建议可以改善

Meanwhile, I have implemented this and works good so far. 同时,我已经实施了该程序,到目前为止效果很好。 I also added MvvM Light framework's messaging feature at the client-side so that it propagate the received message to the models easily. 我还在客户端添加了MvvM Light框架的消息传递功能,以便它将接收到的消息轻松传播到模型。

There is an existing mechanism that wraps a lot of the functionality that you are suggesting (If I understand your needs correctly). 有一种现成的机制可以包装您建议的许多功能(如果我正确理解了您的需求)。 If you need to utilize a WCF service to communicate in a bidirectional way (ie PUSH data to connected clients) I would suggest leveraging the PollingDuplex Binding. 如果您需要利用WCF服务进行双向通信(即,将数据PollingDuplex送到已连接的客户端),建议使用PollingDuplex绑定。

I have used PollingDuplex in the past with various Silverlight clients to exchange data, and I have read articles like this one describing the steps to produce the same behavior in WPF space. 我已经使用PollingDuplex与各种Silverlight客户端过去交换数据,我已经读到这样的文章这样一个描述产生在WPF空间相同的行为的步骤。

This approach will automate much of the endpoint registration and tracking logic that you apparently are thinking of doing manually. 这种方法将使您显然正在考虑手动执行的许多终结点注册和跟踪逻辑自动化。

I hope this helps. 我希望这有帮助。

You might take a look at SignalR instead of trying to force WCF to become a pub/sub platform which is not it's strength. 您可以看一下SignalR,而不是试图强迫WCF成为发布/订阅平台,这不是它的优势。 There is an example on my blog with the visual tracking example with the tracking participant split out from the tracking application so it's not all in one process. 我的博客上有一个示例,其中包含可视跟踪示例,其中跟踪参与者从跟踪应用程序中分离出来,因此这不是一个过程。 That blog also has links to two other blogs where similar things were done, but all using a messaging architecture more suitable to events like this. 该博客还链接到另外两个完成类似操作的博客,但所有博客均使用更适合此类事件的消息传递体系结构。

http://panmanphil.wordpress.com/2012/11/05/slides-and-sample-from-the-chippewa-valley-code-camp/ http://panmanphil.wordpress.com/2012/11/05/slides-and-sample-from-the-chippewa-valley-code-camp/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM