COner
COner

Reputation: 77

Activiti Workflow Invocation from Java code

I am creating an Activiti controller that can listen for messages and fork off the processes on demand.

I have been trying to use the java:

Process p = Runtime.getRuntime().exec("java -jar ...");

as it works just fine when I run normal java executable jars, but in the case of running Activiti projects that are exported the call seems to hang until the Activiti controller completes.

Controller:

while(1){
    print "listening"
    recv message
    print "executing"
    exec process
    print "done"
}

When a message is received all of the prints display, including coming back to the top of the loop. But until I forcibly close the application, or remove the while loop entirely, the process does not actually run.

When the controller code is completed the entire Activiti jar can be seen completing in the command line.

** This is not simply holding the output and displaying it at the end, I know this because the workflow passes messages to other services which i can monitor for Activiti.

** I have tried using runnable and thread instead, placing the exec into another class and the same behavior is exhibited.

Upvotes: 0

Views: 603

Answers (1)

Jochen Bedersdorfer
Jochen Bedersdorfer

Reputation: 4122

Make sure you are reading stdout and stderr from the process.

Upvotes: 1

Related Questions