英文:
IBM Queue Manager over writing the value of User Identifier in MQMD
问题
我们正在尝试使用JMS向IBM MQ写入消息,我们能够写入消息,但注意到MQMD中的UserIdentifier字段被QM管理器覆盖。
我们尝试了以下两个属性来设置用户标识:
message.setStringProperty(JmsConstants.JMS_IBM_MQMD_USERIDENTIFIER, "ourUserID");
message.setStringProperty("JMSXUserID", "ourUserID");
在设置用户ID之前,我们还有以下属性:
message.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED,true);
message.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT,WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT);
此外,队列管理器和队列也具有所需的配置:
+setall +setid +passall
但仍然无法获得所需的结果。在这里我们可以做些不同的事情吗?
英文:
We are trying to write a message to IBM MQ using JMS, we are able to write the message but notice that the field UserIdentifier in MQMD is getting over-written by the QManager.
We've tried both these properties to set user id,
message.setStringProperty(JmsConstants.JMS_IBM_MQMD_USERIDENTIFIER, "ourUserID");
message.setStringProperty("JMSXUserID", "ourUserID");
We also have these properties before setting the User id,
message.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED,true);
message.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT,WMQConstants.WMQ_MDCTX_SET_ALL_CONTEXT);
also the Queue Manager and Queue have the required configuration,
+setall +setid +passall
but still we are unable to get required result. What can we do different over here ?
答案1
得分: 2
这是我程序的一部分:
MQQueue d = (MQQueue)destination;
String altusr="myuserid";
d.setMQMDWriteEnabled(true);
outMsg.setBooleanProperty(MQConstants.WMQ_MQMD_WRITE_ENABLED, true);
outMsg.setStringProperty(CommonConstants.JMS_IBM_MQMD_USERIDENTIFIER, altusr);
d.setIntProperty(MQConstants.WMQ_MQMD_MESSAGE_CONTEXT, MQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
如果您使用的是JMSContext API模型而不是较旧的createSession()方法,可能只有这样才能正常工作,因为这也会影响底层的MQOPEN或MQPUT1何时发生。这反过来会影响上下文设置标志是否被引用。
英文:
This is an extract from one of my programs:
MQQueue d = (MQQueue)destination;
String altusr="myuserid";
d.setMQMDWriteEnabled(true);
outMsg.setBooleanProperty(MQConstants.WMQ_MQMD_WRITE_ENABLED, true);
outMsg.setStringProperty(CommonConstants.JMS_IBM_MQMD_USERIDENTIFIER, altusr);
d.setIntProperty(MQConstants.WMQ_MQMD_MESSAGE_CONTEXT, MQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
It's possible that this only works if you are using the JMSContext API model rather than the older createSession() approach as that can also affect when the underlying MQOPEN or MQPUT1 happens. Which in turn affects whether the context-setting flags are referred to.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论