9 Replies Latest reply on Sep 1, 2010 2:18 PM by Mike Finn

    FaultTo EPR

    Olivier Lemaitre Newbie

      Hello,

      I have been trying to find how to set the FaultTo EPR.

      I have understood that when I have an exception like this one :

      org.jboss.soa.esb.actions.ActionProcessingException: Message transformation failed.


      I can then specify a FaultTo EPR.

      The question is : where to set the EPR.

      I don't know where to start, the sample doesn't seem to use this FaultTo EPR. The documentation speaks about it but does show how to do it as far as I know today.








        • 1. Re: FaultTo EPR
          Kevin Conner Master

          The caller has to specify the FaultTo EPR before sending the message. The best way is to define a fault service and use the LogicalEPR in the FaultTo, for example

          message.getHeader().getCall().setFaultTo(new LogicalEPR("service-category", "service-name"));


          • 2. Re: FaultTo EPR
            Olivier Lemaitre Newbie

            Hello,

            I have succeeded in putting a faultToEPR with the code above.
            It works, but when a fault comes :
            -I stilll have an error message in the (it may be normal)
            -The message does not go to the EPR.

            Here's a part of the server log.

            16:43:53,811 WARN [ActionProcessingPipeline] Unexpected exception caught while
            processing the action pipeline:
            header: [ To: JMSEpr [ PortReference <
            <wsa:Address jms://localhost/queue/gesco_esb/>,
            <wsa:ReferenceProperties jbossesb:destination-type :queue/>,
            <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>,
            <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>,
            <wsa:ReferenceProperties jbossesb:persistent : true/>,
            <wsa:ReferenceProperties jbossesb:acknowledge-mode : 1/> > ]
            
            FaultTo: EPR: PortReference < <wsa:Addresslogical:BAMServices#ErrorService/> >
            
            MessageID: ID:JBM-103936
            
            RelatesTo: jms:correlationID#d4dcbbce-7cbb-4edf-96ec-17e0d39607aa ]
            org.jboss.soa.esb.actions.ActionProcessingException:
            Unexpected invocation target exception from processor at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.process
            Methods(ActionProcessorMethodInfo.java:127)


            I guess I forgot something.
            I don't do anything special in the description of my actions in the jboss-esb.xml.
            Maybe I have to but I don't see what.

            Maybe the "ActionProcessingException" is not handled by the FaultTo. If It is the case what can I do ?

            • 3. Re: FaultTo EPR
              Kevin Conner Master

              I would need to see what you are doing to help further. Is this something that you can send to me? If not, could you create a small example of what you are trying to do?

              • 4. Re: FaultTo EPR
                Olivier Lemaitre Newbie

                Ok kevin I sent you an example of what I want to do.
                Hope it will be clear to you.

                • 5. Re: FaultTo EPR
                  Kevin Conner Master

                  Got it, thanks. I'll have a look at it as soon as I can.

                  • 6. Re: FaultTo EPR
                    Olivier Lemaitre Newbie

                    Hello,

                    I did a little search by myself.
                    I first found the "exceptions_faults" sample which put me on the right way.

                    My mistake was that I did the faulToEpr affectation inside the action chain, it works better when I do it outside.

                    I have a question here, if my service has no caller (ex : a database polling service ) how can I do ?

                    The issue now is that the message that is sent to the FaultToEPR
                    does not contain the original message body any more,
                    it contains system error message :

                    body: [ objects: {org.jboss.soa.esb.message.fault.throwable=org.jboss.soa.esb.ac
                    tions.ActionProcessingException: Unexpected invocation target exception from pro
                    cessor, org.jboss.soa.esb.message.fault.reason=org.jboss.soa.esb.actions.ActionP
                    rocessingException: Unexpected invocation target exception from processor, org.j
                    boss.soa.esb.message.fault.code=urn:action/error/unexpectederror} ]
                    fault: [ urn:action/error/unexpectederror, org.jboss.soa.esb.actions.ActionProce
                    ssingException: Unexpected invocation target exception from processor, org.jboss
                    .soa.esb.actions.ActionProcessingException: Unexpected invocation target excepti
                    on from processor ]


                    Actually I would like to notify by e-mail the system errors + the body of the faulty message.
                    How can I get on to have both sent to the FaultToEPR?

                    Best regards


                    • 7. Re: FaultTo EPR
                      Mark Little Master

                      You can control what is sent in the body of the fault message. Check the Programmers Guide for more details.

                      • 8. Re: FaultTo EPR
                        Matthew Spino Newbie

                        The faulTo will take the Exception and place it into the Fault of a new message. By doing this all data in the message is lost.

                         

                        To perserve the Data, when an exception is thrown

                        1. Catch the exception
                        2. Wrap the message that caused the exception in a Throwable
                        3. Throw that exception
                        4. On the Error Handling Service(EPR), message .getCause().getcause() will retieve the message.
                        • 9. Re: FaultTo EPR
                          Mike Finn Apprentice

                          Mark - can you provide any more specifics ? I can't find anything in there about controlling the transfer of payload to the 'fault' message. Nor in the source.

                           

                          The only way I could figure out how to solve this, without relying on custom handling of exception in actions (which doesn't help when using out-of-box actions), was to patch the org.jboss.soa.esb.listeners.message.errors.Factory class to copy the payload from the input message to the outgoing error message.

                           

                          Can you think of a reason why this is bad idea?

                           

                          Thanks,

                          Mike