-
1. Re: Advice on how to approach CRON based BPMN2 processes
mgeldenhuys Aug 3, 2011 8:12 AM (in response to olddave)1 of 1 people found this helpfulHi Ed,
what about adding the job to the Quartz scheduler which kicks of the process? Meaning, the responsibility of the job which executes in Quartz would be to either create a knowledge session or get one from somewhere to start a process. This way the schedules are managed by Quartz but what happens when the job is executed is managed by JBPM. Then you can also call JBPM to run the process on an ad-hoc basis, without having to handle timers that should not fire in the process.
Would that work?
-
2. Re: Advice on how to approach CRON based BPMN2 processes
olddave Aug 3, 2011 8:27 AM (in response to mgeldenhuys)That would work, but then I miss out on getting details of processes that are running via the gwt-console, because the activation of them is outside Drools. I am starting to think I need the 3rd option a new Start task that has Quartz and a pass through run now option. That way I can see the Process in the list of running processes and by putting the CRON expression in a variable be able to see that detail as well through the gwt-console.
Ed
-
3. Re: Advice on how to approach CRON based BPMN2 processes
swiderski.maciej Aug 3, 2011 9:32 AM (in response to olddave)Have you tried to have a start event and a timer event that can start the process? That is valid approach according to BPMN2. I am referring to something similar as is illustrated on the Events section jBPM documentation just instead of message events have a timer event.
So that should do what you describe - time event will fire on every expiration and you can use default start event to start it whenever you like.
Cheers
Maciej
-
4. Re: Advice on how to approach CRON based BPMN2 processes
mgeldenhuys Aug 3, 2011 10:32 AM (in response to olddave)Using the timer event would not cater for running the process on a complex schedule, since it only allows having the timer activated after a set amount of time which is specified in the timer nodes parameter, and does not have the flexibility of being specified to not run on public holidays.
As I understand putting the CRON expresion in a variable means that you will have to implement the interpretation of the expresion in the gateway node or "run now" node to say when the process should execute. Which you could do and then have a timer event which fires every few minutes and feeds into this node. Or have the "run now" node be a rule task which makes a decision based on the current time, but then not use a CRON expression but a DROOLS business rule.
Another option to implement the functionality using a CRON expression, is to create a second process which manages the creation of scheduled jobs which in turn kick of the actual process you want to execute. The quartz job will have to communicate via some form to the console server (I think it exposes some web services) to run the processes. The main process can then be used to cancel an existing job and its trigger, if one exists and then add a new job and trigger based on the parameter passed though from the node. You will have to look at implementing a domain specific task node for this functionality though.
Mare
-
5. Re: Advice on how to approach CRON based BPMN2 processes
swiderski.maciej Aug 3, 2011 2:41 PM (in response to mgeldenhuys)I agree that timer event will not cover all requirements right now, but I think it would be rather clean solution to handle the basic scenario (excluding holidays). To deal with holiday, you could put rule task just after timer and decide if the particular triggered time falls down to a holiday, and if so cancel that process instance.
-
6. Re: Advice on how to approach CRON based BPMN2 processes
mgeldenhuys Aug 4, 2011 1:52 AM (in response to swiderski.maciej)Agreed, that would be cleaner.
-
7. Re: Advice on how to approach CRON based BPMN2 processes
olddave Aug 4, 2011 6:08 AM (in response to swiderski.maciej)Hi,
So basically you are saying that to start actual work you have 2 stimuli, the Start node directly through the XOR converging gateway and a new work item that is a CRON Timer that produces an internal event that kicks off the process through the XOR converging gateway. So the Start item could have a boolean variable that causes the XOR converging gateway to pass through, otherwise is waits for the event from the CRON Timer.
The things not clear to me are:
1. When the Process is invoked without the boolean variable to pass through then does the CRON Timer just automatically 'run' to check the CRON schedule to check if an event is due to be produced? My understanding is that a node in the Process does not just 'run', it is invoked when the workflow 'hits' it?
2. Once the XOR converging gateway is passed won't the Process continue through to the End node and then finish, thereby leaving no CRON Timer thread to check to see if the next event is due to be produced? I.e. How do we make the Process run permanently? Is this achieved by a loop path in the workflow itself, maybe into that 1st XOR converging gateway where it waits for the event to be produced? If so is that std practice?
I attach what I think would work, comments welcome. The Signal event task would be replaced by the CRON Timer event task.
Thx.
Ed
-
8. Re: Advice on how to approach CRON based BPMN2 processes
swiderski.maciej Aug 4, 2011 2:09 PM (in response to olddave)Ed, I was talking about something like this:
timer events should be maintained by the jBPM engine but I am not entirely sure if that is fully supported. Did not have time yet to verify that.
That would mean that you specify timer definition and new process instance will be every time the timer expires.
Cheers
-
9. Re: Advice on how to approach CRON based BPMN2 processes
olddave Aug 4, 2011 5:38 PM (in response to swiderski.maciej)When I put a Timer task in a workflow it only has 2 useful arguments in the properties sheet, delay and period, no place for a CRON expression. Is there a new Timer type in the development schedule?
Thx.
Ed
-
10. Re: Advice on how to approach CRON based BPMN2 processes
swiderski.maciej Aug 5, 2011 1:41 AM (in response to olddave)Most likely it is limitation of eclipse plugin or other tool you use for diagram modeling.
Try modify its source xml and use something like this:
<timerEventDefinition> <timeCycle xsi:type="tFormalExpression" language="cron">0/1 * * * * ?</timeCycle> </timerEventDefinition>
HTH