<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Replicator Tips and Tricks</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx</link><description>Here are a few tips and tricks for using the ReplicatorActivity successfully. It is a powerful activity which, when approached from the correct point of view, can be relatively easy to use. Definitions seed value - a value added to either of the ReplicatorActivity</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Replicator Tips and Tricks</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#1015618</link><pubDate>Tue, 07 Nov 2006 15:38:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1015618</guid><dc:creator>slavik</dc:creator><description>&lt;p&gt;Thanks for the tips on the replicator.&lt;/p&gt;
&lt;p&gt;I was trying to implement some auction procedure using it and now wonder if my scenario is correct. You can see the workflow at:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://static.flickr.com/121/290421062_d9a2d5d66c.jpg?v=0"&gt;http://static.flickr.com/121/290421062_d9a2d5d66c.jpg?v=0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The first client schedules the auction and then the others are sending their bids, and I'm using webServiceInput-Output. The problem is that after the first client will be answered by the web service, the replicator does not wait for the inputs from clients. I completes its children (fires the events) and completes in the end.&lt;/p&gt;
&lt;p&gt;In the case if I move the replicator on first place in the workflow it waits for only the first replicated webServiceInput-Output and then instantly completes all the other children without receiving input from clients.&lt;/p&gt;
&lt;p&gt;I'm using cookies in this scenario to root the requests to the workflow, but despite the rigth cookie names and values the published workflow doesn't work as expected. Is the solution incorrect?&lt;/p&gt;
</description></item><item><title>re: Replicator Tips and Tricks</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#1019191</link><pubDate>Tue, 07 Nov 2006 20:51:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1019191</guid><dc:creator>ntalbert</dc:creator><description>&lt;p&gt;slavik, the long story short is that you cannot use WebServiceInput/WebServiceOutput inside a Replicator. &amp;nbsp;The reason is that these activities do not support correlation in any manner - in &amp;nbsp;your scenario there is no way to correctly route one client's request to a specific WSInput. &amp;nbsp;For more information on this see correlation.&lt;/p&gt;
&lt;p&gt;If you want to enable the scenario you mention you will be better off using HandleExternalEventActivity and CallExternalMethodActivity and writing your own web service host. &amp;nbsp;While the latter part of this sounds like a major undertaking, writing your own simple web service based host is actually not that bad. &amp;nbsp;Consider the following:&lt;/p&gt;
&lt;p&gt;public class SomeService : WebService&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp;private WorkflowRuntime runtime;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public WorkflowRuntime Runtime&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;get&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;// You can either specify a config section or do programmatic configuration here&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (runtime == null) runtime = new WorkflowRuntime(); &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;return runtime;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;[WebMethod]&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public BidResult EnterBid(Guid instanceId, string clientId, decimal bidAmount)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;BidService bidServ = Runtime.GetService&amp;lt;BidService&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return bidServ.EnterBid(Guid instanceId, clientId, bidAmount);&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Note that the code above is somewhat simplified (config of runtime is left out, BidService implementation is left out, actually getting to BidService will require accessing ExternalDataExchangeService) but this is the psuedocode that will get you to where you want to be.&lt;/p&gt;
&lt;p&gt;BidService is meant to be an ExternalDataExchange service. &amp;nbsp;EnterBid, for example, would raise an event into the workflow and then block waiting for the corresponding response to come back out. &amp;nbsp;You can model this as such:&lt;/p&gt;
&lt;p&gt;// EnterBid style code&lt;/p&gt;
&lt;p&gt;dictionaryOfWaitHandles.Add(responseIdentifier, new ManualResetEvent(false));&lt;/p&gt;
&lt;p&gt;someEvent(...) // one of the parameters is the &amp;quot;response identifier&amp;quot;&lt;/p&gt;
&lt;p&gt;dictionaryOfWaitHandles[responseIdentifier].WaitOne();&lt;/p&gt;
&lt;p&gt;dictionaryOfWaitHandles.Remove(responseIdentifier);&lt;/p&gt;
&lt;p&gt;object result = dictionaryOfResponses[responseIdentifier];&lt;/p&gt;
&lt;p&gt;dictionaryOfResponses.Remove(responseIdentifier);&lt;/p&gt;
&lt;p&gt;return result;&lt;/p&gt;
&lt;p&gt;// CallExternalMethodActivity targetted method which handles the &amp;quot;response&amp;quot;&lt;/p&gt;
&lt;p&gt;dictionaryOfResponses.Add(responseIdentifier, response);&lt;/p&gt;
&lt;p&gt;dictionaryOfWaitHandles[responseIdentifier].Set();&lt;/p&gt;
&lt;p&gt;Again, this is a very simple approach - it assumes a single output, assumes you can block the thread, assumes you aren't using the ManualScheduler, etc. &amp;nbsp;But, this is the basic idea on which you can build what you are looking for.&lt;/p&gt;
</description></item><item><title>re: Replicator Tips and Tricks</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#1036235</link><pubDate>Wed, 08 Nov 2006 18:28:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1036235</guid><dc:creator>slavik</dc:creator><description>&lt;p&gt;Thanks. I supposed that the message is probably &amp;quot;consumed by all the replicated instances at the same time&amp;quot; which means there's no correlation support. But thought there might be some workaround or I'm making some mistake in the scenario. It's bad that the documentation never says that about the webServiceInput.&lt;/p&gt;
</description></item><item><title>Answers to WF Interview Questions</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#5807689</link><pubDate>Thu, 01 Nov 2007 04:13:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5807689</guid><dc:creator>K. Scott Allen</dc:creator><description>&lt;p&gt;Due to popular demand, here are some answers to the questions. Well, not answers exactly ... just...&lt;/p&gt;
</description></item><item><title>Answers to WF Interview Questions</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#5807991</link><pubDate>Thu, 01 Nov 2007 04:53:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5807991</guid><dc:creator>BusinessRx Reading List</dc:creator><description>&lt;p&gt;Due to popular demand, here are some answers to the questions . Well, not answers exactly ... just some&lt;/p&gt;
</description></item><item><title> Advanced Workflow Enabling Tricky Scenarios Replicator Tips and Tricks |  Portable Greenhouse</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#9676136</link><pubDate>Mon, 01 Jun 2009 13:15:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9676136</guid><dc:creator> Advanced Workflow Enabling Tricky Scenarios Replicator Tips and Tricks |  Portable Greenhouse</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://portablegreenhousesite.info/story.php?id=5807"&gt;http://portablegreenhousesite.info/story.php?id=5807&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Advanced Workflow Enabling Tricky Scenarios Replicator Tips and Tricks |  Portable Greenhouse</title><link>http://blogs.msdn.com/advancedworkflow/archive/2006/02/23/538183.aspx#9681220</link><pubDate>Mon, 01 Jun 2009 22:48:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9681220</guid><dc:creator> Advanced Workflow Enabling Tricky Scenarios Replicator Tips and Tricks |  Portable Greenhouse</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://portablegreenhousesite.info/story.php?id=15430"&gt;http://portablegreenhousesite.info/story.php?id=15430&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>