I would like to send a Map<String,MyCustomObject> through Camel using
ActiveMQ JMS , but Camel inspects the body of the message and notes that
it is an instance of Map (JMSBinding.java line 316 in camel 1.5) wraps
it up in a MapMessage and then sends it along.

 

The issue is that the MapMessage spec will only handle Primitives as the
values in a MapMessage and  ultimately this results in an NPE in
activeMq (below). I need to send a complex object as the value. It would
meet my needs if I could avoid the Camel interpretation of my payload
and simply send along an Object message. Is there any way to force the
use of an Object message and just send the Map as an object?

 

Also, I think that checking instanceof Map to try and build a Map
message is a defect as it should check that the values in the Map are
primitives.

 

If anybody knows a way around the MapMessage wrapper code to send a Map
that would be very helpful. I'm using Camel 1.5 and ActiveMQ 5.2

 

Thanks

Joe

 

 

 

java.lang.NullPointerException

      at
org.apache.activemq.util.MarshallingSupport.marshalPrimitiveMap(Marshall
ingSupport.java:63)

      at
org.apache.activemq.util.MarshallingSupport.marshalPrimitive(Marshalling
Support.java:142)

      at
org.apache.activemq.util.MarshallingSupport.marshalPrimitiveMap(Marshall
ingSupport.java:67)

      at
org.apache.activemq.command.ActiveMQMapMessage.storeContent(ActiveMQMapM
essage.java:132)

      at
org.apache.activemq.command.ActiveMQMapMessage.copy(ActiveMQMapMessage.j
ava:111)

      at
org.apache.activemq.command.ActiveMQMapMessage.copy(ActiveMQMapMessage.j
ava:106)

      at
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1634)

      at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer
.java:227)

      at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageP
roducerSupport.java:269)

      at
org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:594)

      at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSend(
JmsConfiguration.java:219)

      at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJ
ms(JmsConfiguration.java:184)

      at
org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)

      at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(Jm
sConfiguration.java:173)

      at
org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:172)

      at
com.recondotech.service.common.BaseService.register(BaseService.java:118
)

Reply via email to