0 Replies Latest reply on May 30, 2013 4:52 AM by m.myslik

    How to get logical EPR from intercepted message?

    m.myslik

      Hi, I am intercepting messages using pipeline interceptors and processing some information about them. I would like to get logicla EPR from the "to" and "from" parameter, however, I am able to get only physical EPR from it.

       

      Do you have any idea how to do it?

       

      I will post here one sample - this is my code for sending ESB messages:

       

      public void sendMessage(String message) throws Exception {

              // Create the delivery adapter for the target service (cache it)

              System.setProperty("javax.xml.registry.ConnectionFactoryClass",

                      "org.apache.ws.scout.registry.ConnectionFactoryImpl");

       

              // Create the delivery adapter for the target service (cache it)

              ServiceInvoker deliveryAdapter = new ServiceInvoker("RedServiceESB",

                      "RedListener");

       

              // Create and populate the request message...

              Message requestMessage = MessageFactory.getInstance().getMessage(

                      MessageType.JBOSS_XML);

       

              requestMessage.getBody().add(message);

              requestMessage.getHeader().getCall().setFrom(new LogicalEPR("BlueServiceESB", "BlueListener")); //sender

       

              // Deliver the request message synchronously - timeout after 20

              // seconds...

              deliveryAdapter.deliverAsync(requestMessage);

          }

       

      As you can see, I am sending a message from "blue" service to "red" service here. When I intercept the message and process the message parameters like this:

       


      String sender = msg.getHeader().getCall().getFrom().getAddr().toString();

      String receiver = msg.getHeader().getCall().getTo().getAddr().toString();

       

      I get these results:

       

      From: PortReference < logical:BlueServiceESB#BlueListener >

      To: PortReference < jms:localhost:1099#queue/Red_Request_esb >

       

      So the "sender" is logical EPR and the "receiver" is physical EPR. My question is why (I know that I am filling the "from" parameter manually, which could be the reason)?

       

      How can I convert this into logical EPR. ALso, is there a way to get something like "BlueServiceESB#BlueListener" and "queue/Red_Request_esb" without all that "PortReference" stuff? I could do this in my java code using regular expression, but perhaps there is some more elegant way I havent found yet.

       

      Thanks for answers!