-
1. Re: Best way to structure a business process with a delay.
kukeltje Aug 3, 2006 2:23 AM (in response to brado)1: I have no idea if this is at all possible this way. What you could do is build a custom node (not difficult) that calls a real scheduler (like quartz) and when that finishes signal this custom node
2: I should see the processdef and code to get a better impression
3: what I mentioned in 1 is an option -
2. Re: Best way to structure a business process with a delay.
gygerl Oct 6, 2006 5:53 AM (in response to brado)Hi Brado,
I need to do something very close :
- start process
- save information
- wait until next business day
- do some update into a parallel application
- send notification
I've tried to define some timer within a task node, as for example :<timer name="wait" duedate='2 minutes' transition='end' > <action name="update" class="ch.ne.gubpm.process.action.UpdateSIPPActionHandler"> </action> </timer> <transition name="end" to="end"/>
but testing this shows me that the task is not waiting the 2 required minutes before calling action and then following transition.
Could you help me anyhow please ?
Thanks in advance. -
3. Re: Best way to structure a business process with a delay.
brado Oct 6, 2006 9:45 PM (in response to brado)Hello gygerl,
I dont know how to work out your declarative approach -- I used a programmatic approach to creating my timer inside my node's ActionHandler, as follows:Date dueDate = <set your due date here>; timer.setDueDate(dueDate); timer.setTransitionName("mytransitionname"); timer.setGraphElement(executionContext.getEventSource()); timer.setTaskInstance(executionContext.getTaskInstance()); timer.setToken(executionContext.getToken()); SchedulerService schedulerService = (SchedulerService) Services.getCurrentService(Services.SERVICENAME_SCHEDULER); schedulerService.createTimer(timer);
That seemed to work fine for me. Hope that helps.
Cheers,
Brad -
4. Re: Best way to structure a business process with a delay.
gygerl Oct 13, 2006 10:00 AM (in response to brado)Hi Brad and thanks for your answer.
I erased the timer definition in the process-definition xml file and defined the timer as you described, but the timer doesn't "hold" the further execution of the node.
As i understood, your code hold the execution until midnight and then the scheduler runs it when duedate "happens", right ?
Did you do any special configuration ? (for scheduler running ??)
Could you send me more code in order for me to compare mine with yours ? (for example : timer definition in process-definition xml file if any, action call in same file, and so on).
Thanks in advance.
Laetitia -
5. Re: Best way to structure a business process with a delay.
brado Oct 13, 2006 10:51 AM (in response to brado)Is your scheduler running? I used the servlets that came with the jbpm start the scheduler.
Brad -
6. Re: Best way to structure a business process with a delay.
gygerl Oct 16, 2006 11:35 AM (in response to brado)Hi Brad,
Well. It was not :((
I am working on making it run but, beyond others, I got this error :17:12:37,667 [JbpmScheduler] INFO ConnectionProviderFactory : Initializing connection provider: org.hibernate.connection.DatasourceConnectionProvider 17:12:37,682 [JbpmScheduler] INFO NamingHelper : JNDI InitialContext properties:{} 17:12:37,713 [JbpmScheduler] FATAL DatasourceConnectionProvider : Could not find datasource: java:/OracleDS javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284) at javax.naming.InitialContext.lookup(InitialContext.java:351) at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56) at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1859) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1152) at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90) at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:74) at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:78) at org.jbpm.persistence.db.DbPersistenceService.getSchedulerSession(DbPersistenceService.java:243) at org.jbpm.JbpmContext.getSchedulerSession(JbpmContext.java:425) at org.jbpm.scheduler.impl.SchedulerThread.executeTimers(SchedulerThread.java:103) at org.jbpm.scheduler.impl.SchedulerThread.run(SchedulerThread.java:70)
Do you know where it could come from ?
I do not get where the configuration needs to be done.
Cheers. -
7. Re: Best way to structure a business process with a delay.
jrojas_pb Oct 16, 2006 2:53 PM (in response to brado)I posted a complete example that works and does what you want. Just as Brad suggested, mine worked only with custom timers -- not created in the process definition.
I later updated the process definition shown in order to get rid of the exception that I was getting.
Anyways, all you have to do is add a node-enter event with the timer parameters you want. The startTime is a new variable I added that allows you to start the timer whenever you want.
eg: startTime=23:59 and repeat=24 hours
to start the timer at then next 11:59 pm, and every 24 hours there after.
http://jboss.com/index.html?module=bb&op=viewtopic&t=92733
Good luck!
John -
8. Re: Best way to structure a business process with a delay.
jrojas_pb Oct 16, 2006 2:56 PM (in response to brado)Sorry, I forgot to include as a link:
http://jboss.com/index.html?module=bb&op=viewtopic&t=92733 -
9. Re: Best way to structure a business process with a delay.
gygerl Oct 17, 2006 5:20 AM (in response to brado)Thanks for your help.
I finally decided to deploy the jbpm webapp instead of trying to start the scheduler separately.
everything works fine now.
Cheers.
Laetitia