Hi JB,

I have found a article to to backup enqueued messages when you need the body
of messages.

 
https://stackoverflow.com/questions/43625848/how-to-see-dequeued-messages-in-activemq

Here is what I changed in active.xml as below:

xmlns:camel="http://camel.apache.org/schema/spring";
<camelContext id="camel" trace="false"
xmlns="http://camel.apache.org/schema/spring";>
                <route>
                        <from
uri="activemq:queue:*?mapJmsMessage=false&amp;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&amp;fileName=routeMessages-${in.header.JMSDestination.physicalName}-${date:now:yyyyMMdd}.txt"
/>
                                        <to uri="activemq:dummy" />
                                </when>
                        </choice>
                </route> 
        </camelContext>

It did output the message but only show the header Info not the message
body.
My message body is json format. How to show the message that we produced ?

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}
ActiveMQObjectMessage {commandId = 5, responseRequired = true, messageId =
ID:qasus3j4q01-17582-1585567320970-512119:1:1:1:1, originalDestination =
null, originalTransactionId = null, producerId =
ID:qasus3j4q01-17582-1585567320970-512119:1:1:1, destination =
queue://MII_TO_MES_WODCN1, transactionId = null, expiration = 0, timestamp =
1589400102298, arrival = 0, brokerInTime = 1589400490488, brokerOutTime =
1590113149463, 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@22bbfc2d, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 6734, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false,
jmsXGroupFirstForConsumer = false}
ActiveMQObjectMessage {commandId = 5, responseRequired = true, messageId =
ID:qasus3j4q01-17582-1585567320970-512257:1:1:1:1, originalDestination =
null, originalTransactionId = null, producerId =
ID:qasus3j4q01-17582-1585567320970-512257:1:1:1, destination =
queue://MII_TO_MES_WODCN1, transactionId = null, expiration = 0, timestamp =
1589400441696, arrival = 0, brokerInTime = 1589400829913, brokerOutTime =
1590113149465, 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@3479f7b2, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 6734, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false,
jmsXGroupFirstForConsumer = false}
ActiveMQObjectMessage {commandId = 5, responseRequired = true, messageId =
ID:qasus3j4q01-17582-1585567320970-512259:1:1:1:1, originalDestination =
null, originalTransactionId = null, producerId =
ID:qasus3j4q01-17582-1585567320970-512259:1:1:1, destination =
queue://MII_TO_MES_WODCN1, transactionId = null, expiration = 0, timestamp =
1589400442245, arrival = 0, brokerInTime = 1589400830461, brokerOutTime =
1590113149466, 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@3d92a98a, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 6459, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false,
jmsXGroupFirstForConsumer = false}

Did you know how to configure the camel object?

Thanks,
Simon






--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Reply via email to