Discussion:
[jboss-user] [jBPM] - Re: Not able to start a process through the Java API
Maciej Swiderski
2013-02-08 17:11:35 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Not able to start a process through the Java API"

To view the discussion, visit: https://community.jboss.org/message/796801#796801

--------------------------------------------------------------
private StatefulKnowledgeSession getKSession(final String changeSetUrl)  throws ProcessRulesException {
     StatefulKnowledgeSession ksession = getKBase(changeSetUrl).newStatefulKnowledgeSession();
      ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
     return ksession;
}
Here you have two issues:
1. you create non persistence session and thus nothing ends up in data base
2. use SystemOutWorkItemHandler as handler for human tasks so it will simply print its properties and move on with the next nodes, most likely ending up as completed process instance

Take a look in the docs on how to setup persistent sessions and make sure that it's configured towards the same db as console.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796801#796801]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jose Miguel Loor
2013-02-08 19:57:56 UTC
Permalink
Jose Miguel Loor [https://community.jboss.org/people/jmiguel77] created the discussion

"Re: Not able to start a process through the Java API"

To view the discussion, visit: https://community.jboss.org/message/796824#796824

--------------------------------------------------------------
Hi Maciej

Thanks for the answer. I found this article:

https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_BRMS_Platform/5/html/BRMS_Business_Process_Management_Guide/Configure_the_Engine_to_use_Persistence.html https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_BRMS_Platform/5/html/BRMS_Business_Process_Management_Guide/Configure_the_Engine_to_use_Persistence.html

As you said, i had to create a persistent session in order to store the data in the database, and as you said, the process started and ended at once.

So, i am asuming that i have to register other Handlers for the *Human Task*; but the bottom line is this:

* It seems to me that my application is doing the job that the server should be doing; i am connecting to the database and the guvnor repository, and persisting all needed data; wich i think is the jbpm's server job
* I had to add a bunch of jars to my app; this might not be meaninful for a desktop application, but in a web application i think they are excessive. True enough, they would not be necessary if the application is deployed in the same server as the brms server, but what if it doesn't ?? In this case, some of those jars are already present in the jboss server, but still, my web app has to deal with the database persistence of the jbpm data, wich, again, i think it is a job for the jbpm server. Am i wrong ??

Finally, the brms server provides a REST api to interact with the server. For a web app, could this be a more feasible solution ??

And again, this approach presents problems by itself. In order to use the REST api with an external java client, i have to change the login-method of the bussiness-central-server, from FORM to BASIC. With this change, i can consume the REST api ok, but the business-central gui, in the brms server, stops working. Any recomendation about this ???

Thanks a lot
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796824#796824]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-02-11 07:37:07 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Not able to start a process through the Java API"

To view the discussion, visit: https://community.jboss.org/message/796981#796981

--------------------------------------------------------------
Jose, all depends on your requirements. There are two main usage scenarios for jbpm (brms):
* as a service - using the deployed version of console
* embedded

As you already noticed that imposes different ways of managing the runtime engine. In as a service it provides you with basic capabilities like starting a process, signal a process instance, etc over REST interface. In embedded mode you have full access to all the API so you have much more options to chose from. But that flexibility comes with a need to include all dependencies of jbpm into your application.
With that said, is up to you what will be best fit for your application. Either way you'll have dependency on the jbpm regardless if that is bundled into your application or runtime dependency on the service exposed by brms/jbpm.

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796981#796981]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Jose Miguel Loor
2013-02-13 20:39:56 UTC
Permalink
Jose Miguel Loor [https://community.jboss.org/people/jmiguel77] created the discussion

"Re: Not able to start a process through the Java API"

To view the discussion, visit: https://community.jboss.org/message/797567#797567

--------------------------------------------------------------
Thanks for your help and clarifications Maciej
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797567#797567]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...