On Jul 22, 2013, at 11:01 AM, Jens <[email protected]> wrote:

> Daniel  Kulp wrote
>>> In this case I receive the request via a JMS "proxy," and the original
>>> ReplyTo queue is inaccessible to my service. Instead I need to send the
>>> reply back to the proxy which will then forward it to the client (this
>>> could
>>> be done by keeping JMSReplyTo intact, I suppose, but we're using fixed
>>> queues anyway so that's unnecessary in this case; effectively, the client
>>> could also just not set JMSReplyTobut it's an external source and out of
>>> my
>>> control unfortunately).
>> 
>> Shouldn't the JMS proxy then be setting a new JMSReplyTo on the message to
>> one that it can remap?
> 
> It would be nice if it did but it's really more of a proxy look-alike and
> there are technical reasons why it cannot modify the proxied messages. If
> CXF cannot ignore the JMSReplyTo field, however, we have little choice but
> to build our own "true" proxy to do just that.


Looking in the code:

    public Destination getReplyToDestination(JmsTemplate jmsTemplate, Message 
inMessage) throws JMSException {
        javax.jms.Message message = 
(javax.jms.Message)inMessage.get(JMSConstants.JMS_REQUEST_MESSAGE);
        // If WS-Addressing had set the replyTo header.
        final String replyToName = 
(String)inMessage.get(JMSConstants.JMS_REBASED_REPLY_TO);
        if (replyToName != null) {
            return resolveDestinationName(jmsTemplate, replyToName);
        } else if (message.getJMSReplyTo() != null) {
            return message.getJMSReplyTo();
        } else if (!StringUtils.isEmpty(jmsConfig.getReplyDestination())) {
            return resolveDestinationName(jmsTemplate, 
jmsConfig.getReplyDestination());
        } else {
            throw new RuntimeException("No replyTo destination set on request 
message or cxf message");
        }
    }

Thus, if you have an interceptor or similar on the chain, you should be able to 
set the JMSConstants.JMS_REBASED_REPLY_TO property on the IN message to 
something else and it should be picked up.


-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to