I had asked this question before :MQDestination overriding accounting token value
According to the response I was even able to set the MQ Accounting token. But the changes have resulted in an impact on the COD which we used to receive earlier. We set the reply to Q and reply to Q Manager as follows
Destination codeDestination = session.createQueue("queue://" + replyToQueueMgr + "/" +replyToQueueName);
logger.info(":::: codeDestination :::"+ codeDestination);
msg.setJMSReplyTo(codeDestination);
Using the above we used to get the COD correctly on the sent queue. But after I added the following line to support Accounting Token
((MQDestination) destination).setMQMDMessageContext(WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT);
After adding the above line COD does not come. If I comment out the above line COD starts coming again but that would mean accounting Token does not get set. I also tried the following line
((MQDestination) destination).setMQMDMessageContext(WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
But even with this I am not getting COD. Its only this context which seems to be causing the issue. Other lines where I am setting MQMDReadEnabled and MQMDWriteEnabled properties is not causing any issue.Can someone please help me on this as I need both COD and Accounting Token?