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.
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?
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).
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?
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:
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?
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.
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?
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/
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?
can you share your MyWorkDefinitions.conf file? probably there is a missing bracket or something missing.
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:
// the Notification work item
"name" : "Notification",
"parameters" : [
"Message" : new StringDataType(),
"From" : new StringDataType(),
"To" : new StringDataType(),
"Priority" : new StringDataType(),
"displayName" : "Notification"
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
Great, can you mark this question as answered, so we can close this thread?