Java代码中的Activiti工作流调用
我正在创建一个 Activiti 控制器,它可以监听消息并根据需要分叉进程。
我一直在尝试使用 java:
Process p = Runtime.getRuntime().exec("java -jar ...");
因为当我运行正常的 java 可执行 jar 时它工作得很好,但是在运行导出的 Activiti 项目的情况下,调用似乎会挂起,直到 Activiti 控制器完成。
控制器:
while(1){
print "listening"
recv message
print "executing"
exec process
print "done"
}
收到消息后,将显示所有打印内容,包括返回到循环顶部。但直到我强行关闭应用程序,或完全删除 while 循环,该进程才真正运行。
当控制器代码完成时,可以在命令行中看到整个 Activiti jar 已完成。
** 这不仅仅是保存输出并在最后显示它,我知道这一点是因为工作流程将消息传递到我可以监视 Activiti 的其他服务。
** 我尝试使用 runnable 和 thread 代替,将 exec 放入另一个类中,并表现出相同的行为。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您正在从进程中读取 stdout 和 stderr。
Make sure you are reading stdout and stderr from the process.