JBoss Community

jBPM 5.4, Persistence, and Safe-Points

created by Franco Gasperino in jBPM - View the full discussion

Community,

 

Excuse the long-winded post. I'm trying to debug an issue with an integration project with the following components:

 

  • jBPM 5.4 final, Drools 5.5 final
  • Spring 3.2.x
  • Bitronix 2.1.x

 

The core jBPM engine is heavily integrated with a custom stack allowing process instances to be created and run via all sorts of connectivity. The custom layer will take the process id & input parameters, delegate to a thread in an executor, which will:

 

  1. Instantiate the drools environment (with JTA support).
  2. Create the knowledge session.
  3. Create a custom WorkItemHandler, associate each custom service task with this handler.
  4. Create and associate the event handlers.
  5. Create and start the process instance.

 

Everything executes as-expected, the JTA is performing commits and I can see the Hibernate activity inserting, updating, and deleting records from the Derby XA database.

 

However, when testing a process instance which *should* trigger a safe-point, i see unexpected behavior. In this case:

 

  • Script "Hello" is a java/groovy/whatever script task.
  • ServiceTask "MockAsyncTask" is a java class, which is associated / registered with the custom WorkItemHandler.
    • executeWorkItem() does NOT call completeWorkItem()
    • Returns control to the jBPM engine, which should trigger a safe-point.
    • Causes return of startProcessInstance(), which will exit the worker thread in the executor.
  • Script "Bye" is a java/groovy/whatever script task.

 

The workflow: Start -> Hello -> MockAsyncTask -> Bye -> End

 

As expected, I see the behavior. I see that the ProcessInstance object associated has a state field of "2", which is active. Howevever, the hibernate update statements on the ProcessInstanceInfo table always have a state value of '0'. This is the breaking behavior.

 

When I attempt to call the adapter layer with the session id, process instance id, work item id, and a payload:

 

  1. Instantiate the drools environment (JTA support).
  2. Load the existing knowledge session.
  3. Create a custom WorkItemHandler, associate each custom service task with this handler.
  4. Create and associate event handlers.
  5. Call completeWorkItem().

 

The workItem does complete, and i see it deleted from the WorkItemInfo table. However, since the process instance state has been reloaded with a value of '0', the "Bye" script task is never fired.

 

Any ideas? A full code dump would be huge, but I'm happy to inject some loggers if it would assist troubleshooting.

 

Thanks!

 

Franco

Reply to this message by going to Community

Start a new discussion in jBPM at Community