Recurrent Process

Hello all!

I have a process that is recurrent, that is, in a certain step, if some requirements are met, there is an activity step of the type Referenced Process that references the process it self…

The problem is that whenever i try to build this process, Developer seems to go in a loop and eventualy fails de build process.

Can someone help?

Thanks in advanced
Pedro Cardoso

can u give us more details?

I think IS flow service doesn’t support recursive calls. it will create a new instance every time you call it.
If you really need to use recursive call, you may want to directly write in java.

What i just said was not totally correct. I just did a quick test with recursive calling with flow service, seems it’s working.
But the key is in the service, you need to have a good logic of exit. If you don’t exit quick enough, it will cause stackOverFlow error right away.

Hi, thankls for the replys.

tongwang, what do you mean “quick enough”?

Kerni, the thing is that I have to design a workflow of tasks of the adhoc kind, where one person can send tasks to n another users, and that users can send taks to another n and so on, can you imagine it? In a recursive way, this is no trouble, but since I don’t know how many iterations oit will be, I can’t design the workflow…

There is just one catch, I can limit n to, say 20… So I can design my flow in a way that one user can do do two things: one, terminate the flow, another, send tasks to other users. Each of the users get a diferent task, that is, a new and diferent instance for each one. Each of the users then can terminate the flow or send to another users and so on…

“quick enough” means if you are recursively calling the service too many times, it will blow up the stack and you get error. You need to exit before this happens.

Setting a limit is a good idea, if the job is not done are 20 rounds, then you may want to review other options. (for example, put your task to a queue, everytime if not done, put it back, then you won’t have the recursive problem at all).


Here is how i would implement it if i understand your requirement correctly.

Create a canonical first that has some structure like this:


Publish doc to broker. It will get subscribed by the trigger and will follow the steps. In the task step if the user assigned a task to n users, group them together and publish back to broker. Make the task assignment based on doc/userID.

You can achieve your recursion this way.
make sense?

Hi Kerni, thanks for the reply.

I believe that my knowledge of WM is not enought to undestand your reply :frowning: