What is the best practice for setting dynamic duedates on timers in jbpm4?
I have a use case were I need to signal a transition at a specific date/time depending on a variable(java.util.Date) in the business process.
In the example below start is a Date variable on the process and this fails due to a classcast exception. This way of setting a dynamic duedate seems to be supported in jbpm 3.x. (e.g. http://docs.jboss.org/jbpm/v3.2/userguide/html/businesscalendar.html).
<state name="waiting">
<transition name="to out" to="out">
<timer duedate="#{start} - 1 days" />
</transition>
..
</state>
Part of stacktrace:
ERROR [ExecuteJobCmd] exception while executing 'ExecuteActivityMessage[11]'
java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.String
at org.jbpm.pvm.internal.job.TimerImpl.setDueDateDescription(TimerImpl.java:76)
at org.jbpm.pvm.internal.model.ScopeInstanceImpl.createTimer(ScopeInstanceImpl.java:303)
at org.jbpm.pvm.internal.model.ScopeInstanceImpl.initializeTimers(ScopeInstanceImpl.java:323)
at org.jbpm.pvm.internal.model.ExecutionImpl.createScope(ExecutionImpl.java:262)
A quick peak in the jbpm source code seems to reveal that the wanted behavior is not possible, hence the starting question. Do i need to create and persist the timer manually? (e.g. node enter event listener)