Workflow 4.0 Content Based Correlation error

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

When working with WF 40 and content based correlation you may get following error:

The execution of an InstancePersistenceCommand was interrupted by a key collision. The instance key with value '300a1ad8-d985-56dc-4075-b45e1aa1faa1' could not be associated to the instance because it is already associated to a different instance.

Remark: The key value (guid in example above) is application specific and in your case the same value will for sure not appear.

This message appears when you initialize the workflow and the correlation token based on some property value in the message, but the workflow with the same property value has already been started.

 

For example, you have receive shape which starts with message and property OrderID=100. The same shape initializes the content based correlation based on the same property. On first call the workflow will be started and at some later point of time persisted. If the client sends the same message now (OrderID=100) the workflow will fail, because it has already been started.

 

Note also: If the workflow ends up before new message with the same ID comes, all will work fine.


Posted Oct 06 2009, 09:46 AM by Damir Dobric
Filed under:

Comments

Damir Dobric wrote re: Workflow 4.0 Content Based Correlation error
on 09-26-2010 13:08

Damir,

Thank you in advance for your time should you decide to help me find an answer to my question.

I am considering using WF4 instead of completing a custom, state-machine based workflow implementation.  I have been reading and watching videos, but I still have a few concerns and questions.

My initial application is a lead processor. I capture certain data, send it to clients, and get responses.  Often, there is a need to delay the sends, or to send to different clients based on responses from other clients.  The delays may be up to a month.

My initial app, described above, currently sends messages to clients at a rate of up to 500 per second. Presently, these are just http posts sent by a multi-threaded windows service.  I am concerned that instantiating, persisting, and resurrecting 500 workflows per second may not be feasible.  Thoughts?

Second, I am having difficulty finding articles that describe activating persisted wokflow instances based on arrival of a message (correlation key).  I was hoping for some sample code and would appreciate if you could point me to something I may have missed.

Finally, after watching the Maurice de Beijer videos on persisted workflows, I am confused about proper handling of multiple workflow types within a single persistence store as well as dynamically changing workflow definitions without having to completely empty my persistence store.

Once again, thank you for your help.

Joshua Greenberg, Ph.D.

Damir Dobric wrote re: Workflow 4.0 Content Based Correlation error
on 09-26-2010 13:11

Hi Josh,

Unfortinatelly your many questions are not easy to answer in a short time, because the requirement is not the easy one.

Anyhow follow below my short answers:

Damir,

Thank you in advance for your time should you decide to help me find an answer to my question.

I am considering using WF4 instead of completing a custom, state-machine based workflow implementation.  I have been reading and watching videos, but I still have a few concerns and questions.

My initial application is a lead processor. I capture certain data, send it to clients, and get responses.  Often, there is a need to delay the sends, or to send to different clients based on responses from other clients.  The delays may be up to a month.

[How are you going to send the data. Such scenarios require some kind of service bus or pub-sub. ?]

My initial app, described above, currently sends messages to clients at a rate of up to 500 per second. Presently, these are just http posts sent by a multi-threaded windows service.  I am concerned that instantiating, persisting, and resurrecting 500 workflows per second may not be feasible.  Thoughts?

[Why are you going to use Workflow for such scenarios? WF is designed for composite apps which are mostly long running.

Using of WF is also possible in this scenario, but I do not think that is necessary mandatory.

I think this way. Persistence is good to ensure that invested energy in some calculation of some logic can be reused. If the calculation is that fast as I understand un your scenario, the invested energy can be dropped (no persistence used) and reinvested again. Why to invest even more energy to persist?]

Second, I am having difficulty finding articles that describe activating persisted wokflow instances based on arrival of a message (correlation key).  I was hoping for some sample code and would appreciate if you could point me to something I may have missed.

[developers.de/.../content-based-correlation-in-workflow-services-4-0.aspx]

Finally, after watching the Maurice de Beijer videos on persisted workflows, I am confused about proper handling of multiple workflow types within a single persistence store as well as dynamically changing workflow definitions without having to completely empty my persistence store.

[I didn’t see his videos. I generally use AppFabric for persistence and monitoring. If you use AppFabric you don’t have to do anything else. It is all out of the box.

Using of multiple persistence store is also more practical question. Whatever you do, because you find it easy handle able it is technically probably ok. Usually I use one store for one business context. For example you have store S1 for WF1 type and store 2S for WF2 type. If it make a sense to drop S1 and keep S2, the sense S1 and S2. But usually keeping instances of type WF2 without of instances of type WF1 doesn’t make a sence. In this case I would use S1 for both.]

Hope this helps

Damir

developers.de is a .Net Community Blog powered by daenet GmbH.