Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageBodyStyle and TextMessage customization #39

Closed
doppiak opened this issue Nov 22, 2019 · 2 comments
Closed

MessageBodyStyle and TextMessage customization #39

doppiak opened this issue Nov 22, 2019 · 2 comments

Comments

@doppiak
Copy link

doppiak commented Nov 22, 2019

Is it possible to set messageBodyStyle and customizing TextMessage (setting WMQConstants.JMS_IBM_CHARACTER_SET)? How?

Using javax.jms I can do:
((MQDestination) sender.getDestination()).setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_MQ);

and I can customize TextMessage like this:

final TextMessage msg = session.createTextMessage();
msg.setIntProperty(WMQConstants.JMS_IBM_CHARACTER_SET, 37);

Thank you

@ibmmqmet
Copy link
Collaborator

ibmmqmet commented Nov 25, 2019

There's probably quite a few ways to do this, depending on how you are writing the rest of the JMS code. This Spring Boot component itself doesn't mandate how you create messages or destinations - it only really helps with the ConnectionFactory setup. But given that a lot of Spring Framework samples use the simple JmsTemplate class, then this may work for you, using a MessagePostProcessor:

jmsTemplate.convertAndSend(qName, inputMsg, ppMsg -> {
      MQDestination dest = new MQDestination(qName);  
      dest.setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_MQ);
      ppMsg.setJMSDestination(dest);
      if (ppMsg instanceof TextMessage) {
        ppMsg.setIntProperty(WMQConstants.JMS_IBM_CHARACTER_SET, 37);
      }     
      return ppMsg;
  });

@ibmmqmet
Copy link
Collaborator

ibmmqmet commented Jan 7, 2020

answered. no additional followup.

@ibmmqmet ibmmqmet closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants