4 Replies Latest reply on Feb 5, 2008 1:32 PM by Mark Little

    Delivering a Synch Message using ServiceInvoker

    Edgar Silva Newbie

      Using ServiceInvoker.deliverAsynch works really well.

      If you try deliver a message with some information, and you must wait for a response, you might use deliverSynch(message,timeout). Some configurations are required for that:

      1) The attribute mep in actions declaration in jboss-esb.xml must be "RequestResponse", if you use mep="OneWay", it will work just for Asynch delivery.
      See the following correct declaration:

      <actions mep="RequestResponse">
       <action name="ReservaAction"
       class="simple.ReservaAssentoAction"
       process="processRequest"/>
      </actions>


      2) In the Action you might change some information, or even create a new message instance, get the original values and set on this newest one message and return it. It seems very simple.

      3) In other hands, when you have a synch processing, you must set an Identification, I guess you must set a valid EPR, however when I set an EPR, I have an exception in message delivery, when I don't set the EPR, it is delivering the message, however I don't have nothing similar to "relatesTo" or "replyTo" to identify my response message. I tryed many instructions from manuals, I've been looking for in the sources, but I have no anwer fot this (what I consider really simple in terms of concepts). See the following example:
      esbMessage.getHeader().getCall().setMessageID(id);
      //esbMessage.getHeader().getCall().setReplyTo(myEPR);
      Message resposta = null;
      ServiceInvoker servicoReserva = new ServiceInvoker("SeatManagerESB","SeatManagerListener");


      I would like to know how deliver a message in a synch mode properly, or as far Kevin answered in another topic(try always if possible asynch), how to simulate or to do it using some best practice or simply the right way.

      Thanks in advance

      Edgar