2 Replies Latest reply on Apr 11, 2013 6:14 PM by Jeff DeLong

    How to model Faults from SwitchYard Services in a jBPM process?

    Jeff DeLong Master

      I ma trying to model the Savara purchasing example as with the StoreService implemented as a BPM Component, which uses a jBPM process to orchestrate two SwitchYard services (CreditAgency and LogisticsService), modeled as SwitchYard Services (not SwitchYard Dynamic Service Tasks). I have a question on how to handle a Fault throw by the CreditAgencyService. The requirement is that if the CreditAgency returns a CustomerUnknownFault the StoreService will return an AccountNotFoundFault.

       

      https://docs.jboss.org/author/display/SWITCHYARD08/BPM describes fault handling properties, however I cannot seem to add these in the SwitchYard Services task

       

      FaultProperties.png

       

      When I hit the Green + alongside Fault Signal Id, nothing happens. Nor is there any thing in the selection box.

       

      By the way, CreditAgency.java defines

       

      public interface CreditAgency {

       

          public org.jboss.examples.creditagency.CreditRatingType creditCheck(

              org.jboss.examples.creditagency.CreditCheckType content

          ) throws CustomerUnknownFault;

      }

       

      and my Intermediate Catch Event does know about this Fault

       

      EventFault.png

       

      Which results in bmpn2

       

      <boundaryEvent id="BoundaryEvent_2" name="" attachedToRef="ServiceTask_1">
        <errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_1"/>
      </boundaryEvent>

        </process>

        <interface id="Interface_1" implementationRef="org.savara.purchasing.creditagency.CreditAgency" name="CreditAgency">

      <operation id="Operation_1" implementationRef="creditCheck" name="creditCheck">
        <inMessageRef>CreditAgency_creditCheck_content</inMessageRef>
        <outMessageRef>CreditAgency_creditCheck_Result</outMessageRef>
        <errorRef>Error_1</errorRef>
      </operation>

        </interface>

        <itemDefinition id="ItemDefinition_1" structureRef="org.jboss.examples.creditagency.CreditCheckType"/>

        <message id="CreditAgency_creditCheck_content" itemRef="ItemDefinition_1" name="CreditAgency_creditCheck_content"/>

        <itemDefinition id="ItemDefinition_2" structureRef="org.jboss.examples.creditagency.CreditRatingType"/>

        <message id="CreditAgency_creditCheck_Result" itemRef="ItemDefinition_2" name="CreditAgency_creditCheck_Result"/>

        <itemDefinition id="ItemDefinition_3" structureRef="org.savara.purchasing.creditagency.CustomerUnknownFault"/>

        <error id="Error_1" name="CustomerUnknownFault" structureRef="ItemDefinition_3"/>

       

       

      In the Boundary Event Event Definitions UI, the Event Type is Error, and this name is not editable. So I am not sure how I would name different events.

       

       

      Once this is sorted out, the next step would be to figure out how to throw the AccountNotFoundFault back to the client.

        • 1. Re: How to model Faults from SwitchYard Services in a jBPM process?
          David Ward Master

          I don't know how much of your trouble here is in the BPMN2 editor, the SwitchYard editor, or the SwitchYard BPM Component runtime.

           

          That being said, I can tell you the name of the event being editable shouldn't be a problem.  That is because what we care about is the id of the event.  For SwitchYard to signal that event, what you need to do is specify an ioSpec config param called FaultSignalId. That needs to match the event id that you want signaled - not the name.

           

          Then, you should specificy what you want to happen after the fault occurs.  To do this, specify an ioSpec config param called FaultWorkItemAction.  Your choices for the value of that param are abort or complete (case in-sensitive).

          • 2. Re: How to model Faults from SwitchYard Services in a jBPM process?
            Jeff DeLong Master

            ioSpec is not visible in the BPMN Editor, so unless I want to edit the source file, I am not sure how to set this.

             

            As far as what to happen after the fault occurs, I want to model this in BPMN2. Abort and complete should be settable on the attached Error Event. From there I want to draw a Sequence Flow to a Send Task, which would send a Fault Message to the client. That is how I would expect to model this in BPMN2.