Using Boot 2.2.2 and Spring Integration 5.2.2 interacting with another application via IBM MQ Series 9; the messages need to be purely text (not JMS). SI can get the text messages correctly, however I cannot seem to put to MQ without a JMS header.
Using JMS without SI, I can write a pure text message by using;
jmsTemplate.send(myQueue, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage(message);
}
});
When using SI I have the following;
@Bean
public IntegrationFlow toQueue(
ConnectionFactory connectionFactory,
@Value("${app.outQueue}") String myQueue
) {
return IntegrationFlows
.from("myIncomingChannel")
.headerFilter("*")
.handle(
Jms
.outboundAdapter(connectionFactory)
.configureJmsTemplate(jts -> jts.jmsMessageConverter(new SimpleMessageConverter()))
.extractPayload(true)
.destination(myQueue)
)
.get();
}
I have tried 8 combinations of;
configureJmsTemplate
extractPayload
true or false.headerFilter
All tests give me a JMS message on the queue. How do I get SI JMS to write a plain text message?
I resolved it using the answer from this post How to remove default Spring JMS Template headers when sending a message to an MQ?
The working version is;
.handle(
Jms
.outboundAdapter(connectionFactory)
.destination("queue:///" + myQueue + "?targetClient=1")
)
.get();