[jboss-dev-forums] [JBoss ESB Development] - How to get logical EPR from intercepted message?

Martin Myslík do-not-reply at jboss.com
Thu May 30 04:52:55 EDT 2013


Martin Myslík [https://community.jboss.org/people/m.myslik] created the discussion

"How to get logical EPR from intercepted message?"

To view the discussion, visit: https://community.jboss.org/message/820312#820312

--------------------------------------------------------------
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!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/820312#820312]

Start a new discussion in JBoss ESB Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2032]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130530/68e7a642/attachment.html 


More information about the jboss-dev-forums mailing list