Hi everyone,
I'm trying to get the ActiveMQ username of the sender of a particular
message into Camel for further processing. However this does not seem to
work.
I have setup my ActiveMQ broker to populate the JMSXUserID message property.
<broker id="broker" brokerName="kronosBroker"
useShutdownHook="false" useJmx="true"
persistent="true" dataDirectory="activemq-data"
populateJMSXUserID="true"
useAuthenticatedPrincipalForJMSXUserID="true"
xmlns="http://activemq.apache.org/schema/core">
With debugging enabled I can see that the message contains the userID as
expected:
13-07-23 13:46:27,916 [INFO]
(org.apache.activemq.broker.util.LoggingBrokerPlugin) -
postProcessDispatch :MessageDispatch {commandId = 7, responseRequired =
false, consumerId = ID:pc22-37613-1374579904970-3:1:1:1, destination =
queue://fromclient, message = ActiveMQBytesMessage {commandId = 6,
responseRequired = false, messageId =
ID:pc22-37613-1374579904970-6:12:-1:1:2, originalDestination = null,
originalTransactionId = null, producerId =
ID:pc22-37613-1374579904970-6:12:-1:1, destination = queue://fromclient,
transactionId = null, expiration = 0, timestamp = 1374579987913, arrival
= 0, brokerInTime = 1374579987913, brokerOutTime = 1374579987914,
correlationId = z1hbqqt065, replyTo = null, persistent = false, type =
null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId
= null, compressed = false, *userID =
ws:RoWkBu9W9HrLXyPyOeXLgD3OwtIrW4si*, content =
org.apache.activemq.util.ByteSequence@6cb2b9ec, marshalledProperties =
null, dataStructure = null, redeliveryCounter = 0, size = 1028,
properties = {LMSMessageType=Ping}, readOnlyProperties = true,
readOnlyBody = true, droppable = false} ActiveMQBytesMessage{ bytesOut =
null, dataOut = null, dataIn = null }, redeliveryCounter = 0}
Additionally I have a very short route defined that just logs the message:
13-07-23 13:46:27,918 [INFO] (fromclient) -
Exchange[ExchangePattern:InOnly,
Properties:{CamelBinding=org.apache.camel.component.jms.JmsBinding@5f41ab78,
CamelToEndpoint=log://fromclient?showHeaders=true&showProperties=true,
CamelCreatedTimestamp=Tue Jul 23 13:46:27 CEST 2013,
CamelExternalRedelivered=false}, Headers:{JMSExpiration=0,
JMSPriority=4, JMSReplyTo=null, JMSDeliveryMode=1,
JMSDestination=queue://fromclient, JMSRedelivered=false, JMSType=null,
JMSMessageID=ID:pc22-37613-1374579904970-6:12:-1:1:2,
JMSCorrelationID=z1hbqqt065,
breadcrumbId=ID:pc22-37613-1374579904970-6:12:-1:1:2, JMSXGroupID=null,
JMSTimestamp=1374579987913}, BodyType:byte[], Body:PING]
--> Here I can't see a user ID (I would expect a JMSXUserID header)
Do you have any idea on why this could happen?
Thanks
Daniel