问题
i'm facing with a problem during the implementation of a workflow process with nservicebus, i use version 2.0.1329.2
and the workflow i'm trying to implement is quite simple:
I have a List of articles that need to be computed, the workflow starts with the first list published. After that the user can do other publish adding or deleting some articles from the original list. Every list has a code identifier.
I have implemented it using an orchestration service identified by the list's code. In the saga data there are also all references of the articles which the list is made of.
The issue is that: when user publish a list of articles while another publish of the same list is in progress there aren't any lock of the process state and in this way there are no concurrency control but the handler which will finish later will have its own data persisted.
for example:
- List with 10 articles to add arrive at time [t], the orchestration service loads saga data from database, modify it and store it at time [t + 5]
- List with 1 item to add arrive at time [t+1], the orchestration service loads saga data from database, modify it and store it at time [t+4]
at time [t+6] i should have 6 added elements but i get only 5 added elements ..
I think the behavior should be like this: the second message if related to the same list should find the process state locked until the first finishes.. Otherwise if related to another list should be parallel processed.
For this i'm wondering if orchestration services aren't properly made to support a workflow process implementation unless setting the number of worker threads to only one losing the parallel efficiency though.
回答1:
You're using a VERY old version of NServiceBus and should upgrade. So many bugs were fixed since then that it really isn't worth your time to try to deal with these issues.
回答2:
You need to design your saga/long running process to work around all the concurrency issues. It's difficult to say or recommend anything else.
Does publishing of articles take such a long time that you come across concurrency issues?
Or, are they re-published so frequently?
When a list of articles is first published, how can someone else modify or re-publish it, when it hasn't been generated yet?
来源:https://stackoverflow.com/questions/12456886/are-orchestration-services-unfit-to-implement-a-workflow-process