Discussion:
[jboss-user] [jBPM] - jBPM noob questions
Viktor Alexandrov
2013-06-28 11:47:11 UTC
Permalink
Viktor Alexandrov [https://community.jboss.org/people/synclpz] created the discussion

"jBPM noob questions"

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

--------------------------------------------------------------
Hello, all. I got some noob (maybe) questions concerning implementing existing scenarios in jBPM. I got some proprietary workflow manager runtime (running on AS7) and tooling to define workflows via graphical editor. The workflows are rather simple and consist of nodes (with in/out parameters) and arrows pointing to the next node (or nodes if current node makes some decisions). Every node is a simple java class that allows to perform some operation: math operations, database lookups/stores, invoke HTTP GET's, log, start another workflows, some proprietary actions and so on.

Now I want to migrate existing service logic to jBPM (actually may be to SwitchYard with jBPM as process orchestrator). Beacause of almost no knowledge in "perfect" BPMN I'm afraid of making wrong architectural decisions :)
I would be very glad if someone could propose me the right solutions or just post some links to the right places to read!

My simple process looks like this:

1. Log some input vars
2. Prepare (map) some additional parameters
3. Query some application properties (config)
4. Query DB with request based on prepared data
5. Modify data (e.g. update modification time)
6. Update data in DB
7. Invoke some sub-process
8. Execute some action through, for example, HTTP or other (proprietary) interface
9. If everything ok, commit data in DB, else rollback and write log
10. Map some paramerers for output
11. Finish


I cannot understand clearly how this should be implemented using jBPM tools. As I could imagine, logging and parameter mapping and runtime bean fileds updating could be performed via Script Node with java expressions, but may be I should use some other tools for it? I cannot find how do I query DB, update DB: is it only done through custom Service Node? Is there a possibility (examples) to use ORM for domain-specific data model? How could I invoke sub-process with, for example, process name and parameters derived in run-time? If someone could supply any more or less complex examples of jBPM usage: with custom data model or custom services invocations, it would be very appreciated.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2013-06-28 12:24:18 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: jBPM noob questions"

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

--------------------------------------------------------------
Hi Viktor,
As you mention in your question, you will need to use Custom Service Node types for doing interactions. Try to avoid using script nodes. Custom Service Nodes are implemented creating new implementations of the WorkItemHandler interface. Those implementations will interact with your external systems. If those interactions are Syncrhonous, jBPM will behave in the same way that your old framework does.
Regarding the operations with the DB which seems to be transactional, it depends on how do you want to do it. If you start a transaction against your DB inside a workItemHandler and then write the logic to see if everything else went right and commit that transaction, everythhing should work. Notice that for what you describe, you don't need to persist your "Flows" because all what you need is to execute the steps and commit or rollback the information to another external database.

Cheers
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Viktor Alexandrov
2013-06-28 13:34:31 UTC
Permalink
Viktor Alexandrov [https://community.jboss.org/people/synclpz] created the discussion

"Re: jBPM noob questions"

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

--------------------------------------------------------------
Mauricio, thanks for the answer. By the way your blog was also very helpful %)

Everything's clear about interactions.
Post by Mauricio Salatino
Try to avoid using script nodes.
Is it ok to use Script Nodes to make thing like "user = String.valueOf(userBean.Name) + "-" + String.valueOf(userBean.Id);"?
Post by Mauricio Salatino
Regarding the operations with the DB which seems to be transactional, it depends on how do you want to do it. If you start a transaction against your DB inside a workItemHandler and then write the logic to see if everything else went right and commit that transaction, everythhing should work.
Could you clarify some things about DB: I found "Data Object" elements in eclipse designer palette, is it something concerning data access? Or what are they made for? It confuses me a little.
Post by Mauricio Salatino
Notice that for what you describe, you don't need to persist your "Flows" because all what you need is to execute the steps and commit or rollback the information to another external database.
Also, concerning persistence and clustering: if I persist my flow instance, does it provide the ability to restart flow from the point it was persisted after system crash/shutdown and restoration to operational state? Could it be configured (coded?) to failover process instances to other running system restoring states from persistent store?
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Viktor Alexandrov
2013-07-02 09:17:52 UTC
Permalink
Viktor Alexandrov [https://community.jboss.org/people/synclpz] created the discussion

"Re: jBPM noob questions"

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

--------------------------------------------------------------
Mauricio, please help me with another question, concerning transactions: if I start UserTransaction in one service task is it propagated to another service task in the same (or sub) flow?
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2013-07-03 08:04:22 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: jBPM noob questions"

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

--------------------------------------------------------------
Hi Viktor,
About your questions:
1) I always discourage the use of script nodes because you are basically writing java inside an xml file, which will make your life more difficult when you do refactorings, it doesn't provide any syntax checking, etc, etc. But if the code that you want to put there is simple enough and it will not cause you troubles in the future you can go ahead knowing the risks.

2) Data Objects are defined in the BPMN2 specification and helps  you to define from where your data is comming from, I usually mention Data Objects as quite advanced structures. As far as I know they are supported in jB
Viktor Alexandrov
2013-07-04 09:03:41 UTC
Permalink
Viktor Alexandrov [https://community.jboss.org/people/synclpz] created the discussion

"Re: jBPM noob questions"

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

--------------------------------------------------------------
1-2-3 got it, thanx a lot.

4) Yes, I've also experienced much joy and pain with transactions, up to writing my own XA transaction manager for very specific use %)
What do you mean saying
In the other hand, if you configure your databases as transactional resources within jbpm, jbpm will define when to start and end the transactions based on the safe points of the processes (Sync and Async activities) .
What do I do to use database inside jBPM? Is it just for process data persistence or I could use some datasources to obtain and set domain specific data?
--------------------------------------------------------------

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

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