Discussion:
[jboss-user] [jBPM] - Re: Process Session ID always 0 in database
Maciej Swiderski
2013-01-03 17:06:48 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
there are two issue with the code you use:
1. you create session that is not persisted and thus process instances are not persisted either and if you create session for every process instance this is probably the reason of having process instance id 0
2. when using HornetQ task client and connecting clients in parallel meaning more than one at the same time (that does not have to mean they will be active at the same time but rather they are connected) you need to ensue that each client is uniquely identified

so for issue 1 you should use JPAKnowledgeService to create/load session and that will ensure you processes are stored in db too. for issue 2 you use pass unique name each time you create AsynHornetQHTWorkItemHandler.

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

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-06 13:45:44 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
Ahh.  I'm assuming that the jbpm-console is set up in this way.  I will be deploying another war file that will be responsible for running sessions and providing restful services for interactive with the human tasks.  Is there a way to get hold of a session from the console-server as this is already configured for persistence to the database?

Gareth.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-11 09:26:49 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
Hi,

I am now using the JPAKnowledgeService to create/Load sessions and they are now persisted.  As for point 2.  My application will have more than one instance of a process live at any one time. Do I need a new AsynHornetQHTWorkItemHandler for each process instance? I seem to remember there being an issue with the handler if it is not named "Human Task" does this make sense?
I will continue reading the jBPM5 Developer Guide book but I would appreciate some guidance.  I want to make sure I can potentially have more than one knowledge base at a time, each running several instances of several processes all persisted.

Thanks in advance,

Gareth.
--------------------------------------------------------------

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

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-01-11 11:06:36 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
Human Task must be used when you registering handler on the work item manager that belongs to the session. I was referring to the name of the HornetQConnector that is created for AsyncHornetQHTWorkItemHandler. This class has alternative constructor that allows you to specify connector name, which might help where.

Of course you can have more than one knowledge base and knowledge session in your system.

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

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-11 11:25:02 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
Thank you.

Would this also work?

         AsyncHornetQHTWorkItemHandler workItemHandler = new AsyncHornetQHTWorkItemHandler(ksession);
         workItemHandler.setConnectorName("Hornet" + sessionId);

Gareth.
--------------------------------------------------------------

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

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-01-11 11:51:06 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
I believe the use of setter is already too late because as part of constructor the connector is created.

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

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-11 11:54:40 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
The other constructor
*AsyncHornetQHTWorkItemHandler*( http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true String connectorName, AsyncTaskService client, KnowledgeRuntime session, OnErrorAction action)

requires a client.

Do I also need to create a client to talk to the HumanTask service?

Gareth.
--------------------------------------------------------------

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

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-01-11 12:09:18 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
you could use this:

new AsyncHornetQHTWorkItemHandler(new AsyncHornetQTaskClient(this.connectorName), ksession, OnErrorAction.LOG)

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

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-11 12:37:14 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Process Session ID always 0 in database"

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

--------------------------------------------------------------
That did the trick, Thanks a lot!

Gareth.
--------------------------------------------------------------

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

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