activemq 5.2.0
camel-2.0-M1

I'm trying to set a header on a JmsMessage based on content contained in the
message.  I then use a choice statement to route to the next destination. 
However, I receive the log message "The jmsMessage is not set yet, call the
super's createMessageId" when the header is tested.  

I'm testing the content in a bean, pseudo-coded as

public class PreProcessor {
  public void determineRouting(Exchange exchange) {
    Message message = exchange.getIn().getBody(Message.class);
    message.setHeader("route", "a");
  }
}

My route configuration looks like this

Predicate isA = header("route").isEqualTo("a");
Predicate isB = header("route").isEqualTo("b");

from("jms:queue:msgin")
.to("bean:preProcessor?method=determineRouting")
.choice()
.when(isA).to("direct:aProcessor")
.when(isB).to("direct:bProcessor");


Debugging where the log message happens, it appears that it occurs after my
PrePrecessor and before the choice:
        at
org.apache.camel.component.jms.JmsMessage.createMessageId(JmsMessage.java:165)
        at
org.apache.camel.impl.MessageSupport.getMessageId(MessageSupport.java:146)
        at
org.apache.camel.component.jms.JmsMessage.copyFrom(JmsMessage.java:77)
        at
org.apache.camel.processor.Pipeline.createNextExchange(Pipeline.java:183)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:86)
        ...

I've dug through the source and discovered that this log message is made if
the javax.jms.Message (aka jmsMessage) is not set on the
org.apache.camel.component.jms.JmsMessage in the exchange.  It is set on the
copy in my original Exchange object.  Judging from the code, it should be
copied when the Exchange is replicated, but that does not appear to be the
case.

My processing is successful, so the log message is a nuisance more than
anything.  I'll have to tweak the log4j settings so that this message
doesn't pollute the logs a few million times a day.  

Obviously someone thought it was important to check and see if the original
JmsMessage was passed along the processing route or not.  Is this a bug?

I've tried various ways to prevent this, but without modifying camel source
code, it doesn't appear feasible.  

Thoughts or suggestions? 

-----
Freelance Application Development Consultant
LinkedIn Profile:  http://www.linkedin.com/in/johnbekasjr
http://www.linkedin.com/in/johnbekasjr 

-- 
View this message in context: 
http://www.nabble.com/The-jmsMessage-is-not-set-yet%2C-call-the-super%27s-createMessageId-tp23283591p23283591.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to