Pratik Shelar
Pratik Shelar

Reputation: 3212

How to set JMS_IBM_MQMD_ACCOUNTINGTOKEN in JMSMessage

After processing a message I need to set the Accounting Token on the msg. How do I set it in the outbound message. I have tried the following and it does not work

msg.setObjectProperty(JmsConstants.JMS_IBM_MQMD_ACCOUNTINGTOKEN,value)

where value set is a byte[]. But when I observe the message the AccountingToken is not getting set.

Is there something I am missing over here?

Upvotes: 0

Views: 696

Answers (2)

Pratik Shelar
Pratik Shelar

Reputation: 3212

After further analysis I found that the reason why it was not getting set was because the following property was not set.

((JmsDestination) dest).setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true);   

After setting the above value the accounting token was available.

Upvotes: 1

Pino
Pino

Reputation: 9303

From IBM Knowledge Center:

For certain properties, you must also set the WMQ_MQMD_MESSAGE_CONTEXT property on the Destination object. (...)
The following properties require WMQ_MQMD_MESSAGE_CONTEXT to be set to WMQ_MDCTX_SET_IDENTITY_CONTEXT or WMQ_MDCTX_SET_ALL_CONTEXT:

JMS_IBM_MQMD_UserIdentifier
JMS_IBM_MQMD_AccountingToken
JMS_IBM_MQMD_ApplIdentityData

Upvotes: 0

Related Questions