public void configure() throws Exception {
from(uri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
// do not mutate it
JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());
// get header should not mutate it
assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
}
})
// setting a new header should mutate it
.setHeader("HEADER_1", constant("VALUE_2"))
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
// it should have been mutated
JmsMessage msg = assertIsInstanceOf(JmsMessage.class, exchange.getIn());
assertNotNull("javax.jms.Message should not be null", msg.getJmsMessage());
// get header should not mutate it
assertEquals("VALUE_2", exchange.getIn().getHeader("HEADER_1"));
}
})