我正在尝试向WMB发送消息,指定encoding = 273,但是它仅更改Properties和MQRFH2中的编码,而不更改MQMD中的编码(此处为546)。我究竟做错了什么?
@Autowired
private JmsTemplate jmsTemplate;
private static final String SETTINGS_QUEUE = "REQUESTS/INTERNAL/GETSETTINGS";
public void sendSettingsMessage(String componentName, String componentVersion) {
try {
MQTopic topic = new MQTopic(SETTINGS_QUEUE);
topic.setMQMDWriteEnabled(true);
topic.setEncoding(WMQConstants.WMQ_ENCODING_NATIVE);
jmsTemplate.send(topic, session -> {
Message message = session.createMessage();
message.setStringProperty("resource", "/settings/" + componentName + "." + componentVersion);
message.setStringProperty("method", "GET");
message.setStringProperty("source", "UI");
message.setIntProperty(WMQConstants.JMS_IBM_ENCODING, WMQConstants.WMQ_ENCODING_NATIVE);
message.setIntProperty(WMQConstants.JMS_IBM_MQMD_ENCODING, WMQConstants.WMQ_ENCODING_NATIVE);
return message;
});
} catch (JMSException e) {
throw new RuntimeException(e);
}
}