This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Publishing contents of an XML document to a topic in JMS

 
Arpan Joshi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to develop a JMS based messaging system using pub-sub model.
Before my publisher publishes messages it has to parse an XML configuration file which will be as follows:

<consumerConfiguration>
<name>BSA-TimeCard</name>
<topic>Some-Topic</topic>
<JMSProvider>100.100.2.2</JMSProvider>
<destination>BSA.OUTGOING</destination>
<body>
CDATA
</body>
</consumerConfiguration>

Values for all of these elements are required and based on the value of topic element I want to select the topic to publish this message to. In this case the value of topic element in the configuration file is timecard so my topic for this message has to be timecard. Now, the elements till the body elements are all part of my header and I don't want to send the header as part of my message. Once the header information(all header elements are present) is verified (if not I want to throw an exception),
I want to send the CDATA(if not empty) which is the message body as part of my JMS message.

Please help me in solving this problem. I am ok in validating the XML file before send it as a message but verifying the header information and choosing the topic on the basis of the topic element is what I need help with.

Hope this is clear enough.

Thanks

arpan
 
RNivas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think ebml/ebxml can help you out for this
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
choosing the topic on the basis of the topic element is what I need help with.

Extracting the text content of an element is a basic XML processing task. You will find it covered extensively in the many XML tutorials to be found on the net.
You also need to become familiar with the API that describes the structure of XML documents to be found in the org.w3c.dom package in your JavaDocs.
Start with the org.w3c.dom.Node interface.

RNivas - you need to go make your name compatible with the Javaranch naming policy before a sheriff gets on your case.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic