3 Replies Latest reply on Dec 22, 2011 10:46 AM by Dennis Buttery

    ServiceInvoker deliverSync() losing faultTo EPR

    Dennis Buttery Newbie

      Hi all,

       

         I have an ESB  sends messages to a separate service (also ESB) and waits for a response.  The communciation is done using the ServiceInvoker deliverSync() method.

       

         Prior to invoking the service the request message is composed and a faultTo EPR is set on that message.  The second service receives the message, processes and responds.  When the response is received back at the caller the faultTo on the message is now NULL. 

       

         I log the faultTo as it is being sent on the request, when it received by the service and on the response heading back and it is valid in all cases.  It is only when it is received back in the caller that is is NULL.

       

         Simple question:  Why?!?!?

       

      Regards,

      -Dennis

        • 1. Re: ServiceInvoker deliverSync() losing faultTo EPR
          Dennis Buttery Newbie

          A little more info ...

           

          In the service that handles the request I am creating a response message.  On that response I am copying the faultTo from the request message.  I am also using the message context and properties.   I see all of this information is intact right before the response message is returned to the caller.

           

          In the caller, when the response is received, all of the additional information (context/properties/faultTo) is missing and I only have the message body that I had placed on the response.

           

          I would have expected that the response message would have been delivered in its entirety as I had composed it.

           

          Is there any known workaround to prevent that from happening?

           

          Regards,

          -Dennis

          • 2. Re: ServiceInvoker deliverSync() losing faultTo EPR
            Tom Cunningham Master

            If you want to set your own custom FaultTo/replyTo, you are going to have to use deliverAsync.     deliverSync is designed to deliver the message back (you've deliberately asked for a synchronous reply), fault or not.     This is an issue which has received quite a bit of discussion and there's a JIRA filed on changing the default behavior (https://issues.jboss.org/browse/JBESB-3676), but currently this is expected behavior.

             

            There's quite a few ways you can work around this - change your code to use deliverAsync, or you can use deliverSync in ServiceA and then catch the exception and then deliver the fault where you want in the catch, or you can configure an exceptionMethod in ServiceB which sends a fault Message to ServiceZ, or you can use a middleman service which takes care of the fault logic.

            • 3. Re: ServiceInvoker deliverSync() losing faultTo EPR
              Dennis Buttery Newbie

              Thanks Tom.

               

              I am going with the idea of catching the exception and delivering the fault to a specified service.

               

              Seems to work pretty efficiently that way ...