Raj GT
Raj GT

Reputation: 25

Sending xml messages to IBM MQ using spring batch

I have a requirement to send xml messages to IBM MQ.

  1. Receiving messages from source system and converting into xml and send that to IBM MQ using JMS.

  2. Receiving xml messages from source system and sending directly to IBM MQ.

For the second requirement, the xml needs to be converted as JMS message using spring batch or else it can be directly send to IBM MQ?

Please give me an advise on this.

Upvotes: 1

Views: 3116

Answers (1)

Tim McCormick
Tim McCormick

Reputation: 956

If you're using JMS, then any message you attempt to send to a JMS provider (such as MQ) needs to be wrapped into a class implementing javax.jms.Message:

http://docs.oracle.com/javaee/5/api/index.html?javax/jms/Message.html

In your instance it really depends how you're storing your XML. I'm not aware of any such thing as an 'XML Message'. I should imagine you're either storing it at a String or an Object of some type.

One option is to use a javax.jms.TextMessage with a String representation of your XML.

Or if your XML object is serialiseable and the receiving entity can deserialise the Object you could consider a javax.jms.ObjectMessage.

Upvotes: 1

Related Questions