-
1. JBPM5 Exception Handling
salaboy21 Jan 17, 2011 12:08 PM (in response to npereira)Hi there..
if you are using a Script task with java code in it, you must handle the exception with a Try/Catch block as you normally do it Java. If you are talking about business exceptions (not java, not related with java code at all) that's a different story. But they are not Java exceptions, they are business exceptions.
Greetings.
-
2. JBPM5 Exception Handling
npereira Jan 18, 2011 5:53 AM (in response to salaboy21)Hi,
Thank you for your reply....
The problem I'm facing is, for example, if I need to contact a webservice.
If this fails, what can I do besides managing errors in Java Code. Can I for example, suspend the script task? And later come to it and resume it and re-run it?
Another thing is what does the "Error Event" do? How does it work?
Regards
-
3. JBPM5 Exception Handling
salaboy21 Jan 18, 2011 6:41 AM (in response to npereira)Hi there, I recommend you to take a look at work items / custom domain specific nodes... You can create sync and async workitems to have different mechanisms for retrying an execution. Using script task for calling a web service is not recommened. The reasons are all the ones that you mention. (remember that you are basically coding java inside an XML file). The Error Event is about Business Expcetions / that node can be used to model a branch of the process that needs to be executed on exceptional business cases.. (not java / low level related problems).
Greetings.
-
4. JBPM5 Exception Handling
npereira Jan 21, 2011 12:00 PM (in response to salaboy21)Hi there,
That sounds exactly what I'm looking for.
Can you please, tell me where I can find more information on sync and async workitems, and in particular how can I create one?
Regards.
-
5. JBPM5 Exception Handling
salaboy21 Jan 21, 2011 12:25 PM (in response to npereira)Hi there.. it's a very simple mechanism. You need to implement the WorkItemHandler interface and put your logic inside the execute() method.
Then you need to register you implementation in the workItemManager inside the session:
ksession.getWorkItemManager().registerWorkItemHandler( "MyWorkItemManager",
myImplementation );
-
6. JBPM5 Exception Handling
npereira Jan 21, 2011 6:05 PM (in response to salaboy21)Hi,
Thanks for your answer....
Although I was more looking for something along the lines of how to develop a new object to add it on the BPMN UI of eclipse.
The idea is that, when I'm modeling new workflows I will be able to use and re-use this object in different occasions.
Is this possible? and is there any documentation I should be looking at?
Regards
-
7. JBPM5 Exception Handling
salaboy21 Jan 22, 2011 7:57 PM (in response to npereira)The solution that I've proposed to you is exaclty that. You can reuse your work items in different processes and you can also attach workitem definitions to your eclipse palette.
Take a look at:
To see how to acheive that.
Greetings!
-
8. JBPM5 Exception Handling
npereira Jan 24, 2011 9:05 AM (in response to salaboy21)Hello,
This really seems what I'm looking for, but unfortunately I'm running into some troubles.
I don't quite understand the following the "Registering the work definition".
It says that we should: "For example, include a drools.rulebase.conf file in the META-INF directory of your project"
But I don't have a META-INF on my project!? can I put it any where else?
-
9. JBPM5 Exception Handling
salaboy21 Jan 24, 2011 9:14 AM (in response to npereira)Hi there,
No, just create the META-INF directory and the file inside it. Are you using maven? the META-INF directory should be included inside the application classpath, so you probably want to create it in src/java/main/META-INF/
Greetings.
-
10. JBPM5 Exception Handling
npereira Jan 24, 2011 10:47 AM (in response to salaboy21)Hi there,
Thank you for that.
I did that, but I think it's not picking up my "MyWorkDefinitions.conf" file
I've place this file all over the project, but it continues to say: "Could not parse work definitions MyWorkDefinitions.conf:null"
Can you help me out?
-
11. JBPM5 Exception Handling
salaboy21 Jan 24, 2011 10:52 AM (in response to npereira)can you share your MyWorkDefinitions.conf file? probably there is a missing bracket or something missing.
Greetings
-
12. JBPM5 Exception Handling
npereira Jan 24, 2011 11:01 AM (in response to salaboy21)Sure,
Although, after trying several combinations, I remove the file itself from the entire project and tried it again. And the result was the same, "Could not parse work definitions MyWorkDefinitions.conf:null"
But nevertheless, the file is the following:
import org.drools.process.core.datatype.impl.type.StringDataType;
[
// the Notification work item
[
"name" : "Notification",
"parameters" : [
"Message" : new StringDataType(),
"From" : new StringDataType(),
"To" : new StringDataType(),
"Priority" : new StringDataType(),
],
"displayName" : "Notification"
]
]
-
13. JBPM5 Exception Handling
npereira Jan 24, 2011 11:53 AM (in response to npereira)Hi there,
I was finally able to do it. I don't know why but I created a new project and with the same files, was able to do it.
Just added everything into the Meta-Inf directory and everything worked out!
Thanks for all the help
-
14. JBPM5 Exception Handling
salaboy21 Jan 24, 2011 12:05 PM (in response to npereira)Great, can you mark this question as answered, so we can close this thread?
Greetings.