<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Catch Java ServiceTask exceptions using errorEventDefinition in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30385#M15598</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We've discussed this internally when we implemented the error boundary event, and we came to the conclusion that the error event is meant for errors with a 'process' meaning. A Java exception is something that always will be implemented by a developer, so that stuff needs to be hidden from the common model between devs and analysts. However if you want the semantics you write, you could catch your exception and call the ErrorEndEventActivityBehavior yourself.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Feb 2011 08:56:08 GMT</pubDate>
    <dc:creator>jbarrez</dc:creator>
    <dc:date>2011-02-17T08:56:08Z</dc:date>
    <item>
      <title>Catch Java ServiceTask exceptions using errorEventDefinition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30382#M15595</link>
      <description>My process incorporates a Java ServiceTask which throws an exception in case of an error.Now I would like to catch this error in the process.I tried to attach a boundaryEvent including an errorEventDefinition to the serviceTask as shown in the folowing example:&amp;lt;serviceTask id="javaService" …/&amp;gt;</description>
      <pubDate>Tue, 15 Feb 2011 09:56:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30382#M15595</guid>
      <dc:creator>kaech</dc:creator>
      <dc:date>2011-02-15T09:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Catch Java ServiceTask exceptions using errorEventDefinition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30383#M15596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Error events are used for 'business' exceptions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Java exceptions need to be handled in a different way, from the userguide;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;When custom logic is executed, it is often required to catch certain exceptions. One common use case is to route process execution through another path in case some exception occurs. The following example shows how this is done.&lt;BR /&gt;&lt;BR /&gt;&amp;lt;serviceTask id="javaService" &lt;BR /&gt;&amp;nbsp; name="Java service invocation" &lt;BR /&gt;&amp;nbsp; activiti:class="org.activiti.ThrowsExceptionBehavior"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;lt;/serviceTask&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;lt;sequenceFlow id="no-exception" sourceRef="javaService" targetRef="theEnd" /&amp;gt;&lt;BR /&gt;&amp;lt;sequenceFlow id="exception" sourceRef="javaService" targetRef="fixException" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Here, the service task has two outgoing sequence flow, called exception and no-exception. This sequence flow id will be used to direct process flow in case of an exception:&lt;BR /&gt;&lt;BR /&gt;public class ThrowsExceptionBehavior implements ActivityBehavior {&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; public void execute(ActivityExecution execution) throws Exception {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String var = (String) execution.getVariable("var");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PvmTransition transition = null;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; executeLogic(var);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transition = execution.getActivity().findOutgoingTransition("no-exception");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Exception e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transition = execution.getActivity().findOutgoingTransition("exception");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; execution.take(transition);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;}&lt;/CODE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Feb 2011 13:05:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30383#M15596</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2011-02-15T13:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Catch Java ServiceTask exceptions using errorEventDefinition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30384#M15597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you. I somehow missed that in the user guide.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the suggested approach, part of the process flow would be hidden in Java code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From a modeling perspective that's a bit weird, isn't it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wouldn't it be better to catch the exception in the process as shown in my example above?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Feb 2011 13:53:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30384#M15597</guid>
      <dc:creator>kaech</dc:creator>
      <dc:date>2011-02-15T13:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Catch Java ServiceTask exceptions using errorEventDefinition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30385#M15598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We've discussed this internally when we implemented the error boundary event, and we came to the conclusion that the error event is meant for errors with a 'process' meaning. A Java exception is something that always will be implemented by a developer, so that stuff needs to be hidden from the common model between devs and analysts. However if you want the semantics you write, you could catch your exception and call the ErrorEndEventActivityBehavior yourself.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Feb 2011 08:56:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30385#M15598</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2011-02-17T08:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Catch Java ServiceTask exceptions using errorEventDefinition</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30386#M15599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I agree that the process modelers should not get in touch with Java exceptions implemented (thrown) by Java developers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But from the developer side the situation is the same. The service developer should not care about the process in which the service is used. I think the process and the service should solely interact based on a contract.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Such a contract normally comprises in and out messages and exceptions. For Java this would be a Java interface.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If we implemented it in the way you suggested, it would mean that the service task requires knowledge about the process in which the service is used. Of course that is possible but process changes (e.g id changes) would require a change in the Java code. From a service design perspective that is far from being ideal.The Java code would rather become an itegral part of the process model limiting service reusability.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Possibly a better approach would be that the Java classes implementing the service tasks have to throw a certain Activiti exception instead of just Exception. This ServiceTaskException could have an errorId parameter to return an error code that can be handled by the process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you think?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Feb 2011 14:38:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/catch-java-servicetask-exceptions-using-erroreventdefinition/m-p/30386#M15599</guid>
      <dc:creator>kaech</dc:creator>
      <dc:date>2011-02-17T14:38:24Z</dc:date>
    </item>
  </channel>
</rss>

