FIM custom portal workflow for unique accountName generation – how to make it thread safety?

Hello,

Ive been using the workflow from here: http://www.wapshere.com/missmiis/generate-unique-attribute-activity to generate unique accountName. Everything seems to work, except, its not using one thread. That is while for the first user it is calling the enumerateResourceActivity, then for the second user it starts another workflow (even if for the first user workflow is not finished). And when for the second user the search for unique values is made in the portal, the changes for the first one (generated unique accountName) may still not be submitted, so the same accountName will be generated for the second user.

What changes should I make to the workflow to force to start the workflow for the next user only when the workflow is finished for the current one?

I've tried to put the whole workflow in synchronizationScopeActivity, but after changes my workflow is not loaded at all.


June 13th, 2013 6:10pm

You can't do something like this with FIM workflow host (at least I think you can't do this -probably someone can figure it out as there is not much things in IT which can't be done). Only solution I can think of for such problem at workflow level is:

- use some system wide semafor entry\object, to which access needs to be obtained for operation to take place. Standard mechanism from dev world. In that case only one workflow can obtain access to this semafor object at a time and rest of workflows needs to wait until it will be released(you have to think how to handle possible not released locks, concurrency etc)

Implementation of above would be naming service which will be asked for a unique name - in that case this service will be able to do "reservation" for the name and ensure that two separate requests will never get same value.

Free Windows Admin Tool Kit Click here and download it now
June 13th, 2013 6:27pm

Hello Tomasz,

thank You for your suggested implementation, but could you please give me more detailed explanation?

My thought is to put all the code in one Code component and use lock. Is it possible to implement?

I'm also considering to try Tools4Fim Function Evaluatorhttp://www.oxfordcomputergroup.com/Tools.aspx. Will it have the same issue? Or should I better use rule extension for this?

Are there any other options?


June 18th, 2013 1:30pm

Finally I've ended up with rule extension as it is quite easy to develop and debug.

Thanks for suggestions.

Free Windows Admin Tool Kit Click here and download it now
July 25th, 2013 7:06am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics