'Is there a way to send message with MQSTR format using JmsSendingMessageHandler

I am using JmsSendingMessageHandler to send JMS message

@Bean
@ServiceActivator(inputChannel = "queueChannel" )
public MessageHandler sendMessageOnTopic() {

    JmsSendingMessageHandler messageHandler = new JmsSendingMessageHandler(jmsTemplate);
    messageHandler.setDestinationExpression(new FunctionExpression<Message<?>>(message -> message.getHeaders().get("destination")));
    return messageHandler;

}

by default messages goes to MQ with format MQHRF2. problem with that is mainframe only understands MQSTR format,

Is there a way I can do it with some configuration or adding any headers (I tried adding JMS_IBM_Format to MQSTR as message header but did not work) ?

I am able to achieve the same if I use jmsTemplate directly like below

jmsTemplate.convertAndSend("queue:///" + message.getHeaders().get("destination") + "?targetClient=1", message.getPayload());

I was wondering if I can achieve the same results with JmsSendingMessageHandler ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source