camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark White (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CAMEL-1867) JmsKeyFormatStrategy not used consistently and JmsMessage.getHeader() not returning correct value
Date Thu, 30 Jul 2009 17:38:33 GMT

     [ https://issues.apache.org/activemq/browse/CAMEL-1867?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mark White updated CAMEL-1867:
------------------------------

    Attachment: JmsPassThroughtJmsKeyFormatStrategyTest.java

I tried running the tests against M3 and indeed the 'HEADER.1' key is added to the message
in M3 but not in trunk, so that appears to be an improvement.  But there is still a problem
on the getHeader() in trunk.

The unit test doesn't do enough to show - instead of testing the new header value, I changed
it to test the change of the input header value, this then causes the error where getHeader(key)
is returning a different value from getHeaders().get(key) and so test fails - code is attached.
 I also added some output of the headers in my copy and you can see difference in the two
values:

--Start Message Headers (from getHeaders().get(key)) --
HEADER_1=VALUE_2
--End Message Headers--
--Start Message Headers (from getHeader(key)) --
HEADER_1=VALUE_1
--End Message Headers--


> JmsKeyFormatStrategy not used consistently and JmsMessage.getHeader() not returning correct
value
> -------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1867
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1867
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-jms
>    Affects Versions: 2.0-M3
>         Environment: 2.0-M3
>            Reporter: Mark White
>         Attachments: JmsPassThroughtJmsKeyFormatStrategyTest.java, log.out, MessageTester.java
>
>
> On entry to a route from a JMS endpoint configured with PassthroughJmsKeyFormatStrategy
the headers with underscores (_) are passed through correctly.
> However, when any header value in the message is then changed, the original headers are
added back into the message using the DefaultJmsKeyFormatStrategy.  For example, sending a
JMS message with headers;
> HEADER_1=VALUE_1
> HEADER_2=VALUE_1
> we do see just these two headers in the message received into the route.
> However, if we then set a header value in the route, say HEADER_1=VALUE_2, we now see
the headers;
> HEADER.1=VALUE_1
> HEADER.2=VALUE_1
> HEADER_1=VALUE_2
> HEADER_2=VALUE_1
> For some reason in the set header process the original message headers and values get
added into the message after being passed through the DefaultJmsKeyFormatStrategy.  This has
the implication of unnecessary duplication of the headers.
> Also, when a message header is accessed using the getHeader(key) method it also goes
through the DefaultJmsKeyFormatStrategy to decode the key that is passed.  
> In the example above, if after we have updated 'HEADER_1' to 'VALUE_2', we do;
> message.getHeader("HEADER_1") this goes through the DefaultJmsKeyFormatStrategy and actually
gets executed as message.getHeader("HEADER.1") which returns VALUE_1 (wrong!).
> Note: if instead we lookup the header through message.getHeaders() which returns the
all headers in a Map, we can correctly access the 'HEADER_1' key.  (Why is getHeader(key)
even going through the KeyFormatStrategy anyway if setHeader() isn't?)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message