Two different methods of viewing the message content both indicate that there's no message body? That sounds like maybe your messages don't have bodies...
I'm not an expert in Camel, but I've done enough with it to believe that the method you found will capture the full message (headers and body), so I don't think there's reason to believe that the code you found is wrong or doesn't work as expected. Tim Tim On Tue, May 26, 2020, 12:23 PM skao <simonkao2...@gmail.com> wrote: > This is exactly what I added in activemq.xml as below. > > It only created the header Info instead of the real message body. > It looks exactly the same when I review it in activeMQ console. > No detail message body. > > > xmlns:camel="http://camel.apache.org/schema/spring" > > <bean id="ActiveMQVMConnectionFactory" > class="org.apache.activemq.ActiveMQConnectionFactory"> > <property name="brokerURL" > value="vm://localhost?create=false&waitForStart=10000"/> > <property name="userName" value="${activemq.username}"/> > <property name="password" value="${activemq.password}"/> > </bean> > <bean id="activemq" > class="org.apache.activemq.camel.component.ActiveMQComponent" > > <property name="connectionFactory" > ref="ActiveMQVMConnectionFactory"/> > </bean> > > > <camelContext id="camel" trace="false" > xmlns="http://camel.apache.org/schema/spring"> > <route> > <from > > uri="activemq:queue:*?mapJmsMessage=false&selector=CamelFileNameProduced > IS NULL" /> > <choice> > <when> > > <simple>${in.headers.CamelFileNameProduced} == null</simple> > <setHeader > headerName="CamelJmsDestinationName"> > > <simple>${in.header.JMSDestination.physicalName}</simple> > </setHeader> > <transform> > > <simple>${in.body}\n</simple> > </transform> > <to > > uri="file://data/activemq/?fileExist=Append&fileName=routeMessages-${in.header.JMSDestination.physicalName}-${date:now:yyyyMMdd}.txt" > /> > <to uri="activemq:dummy" /> > </when> > </choice> > </route> > </camelContext> > > > Output : > > ActiveMQObjectMessage {commandId = 5, responseRequired = true, messageId = > ID:qasus3j4q01-17582-1585567320970-393665:1:1:1:1, originalDestination = > null, originalTransactionId = null, producerId = > ID:qasus3j4q01-17582-1585567320970-393665:1:1:1, destination = > queue://MII_TO_MES_WODCN1, transactionId = null, expiration = 0, timestamp > = > 1588928817382, arrival = 0, brokerInTime = 1588929169025, brokerOutTime = > 1590113149462, correlationId = null, replyTo = null, persistent = true, > type > = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = > null, compressed = false, userID = null, content = > org.apache.activemq.util.ByteSequence@43dda78c, marshalledProperties = > null, > dataStructure = null, redeliveryCounter = 0, size = 6741, properties = > null, > readOnlyProperties = true, readOnlyBody = true, droppable = false, > jmsXGroupFirstForConsumer = false} > > > > > -- > Sent from: > http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html >