what is benefit of sending xml using jms

百般思念 提交于 2019-12-25 08:05:53

问题


In out current project we have been sending xml as textmessage using jms. I do not understand why are they not simply sending Objectmessage, why have the overhead of processing xml ?

so the question basically boils down to why use xml in jms ?


回答1:


It all boils down to a design decision on the message serialization format.

At first Objectmessage would appear to be the most efficient mechanism. However it would not work well in the following scenarios:

  1. Message validation (XML Schemas act as a form of message contract)
  2. Differences in software versions between sender and receiver (Message versioning)
  3. Communication with non-Java systems

Serializing the message in XML does not completely solve these problems, but some form of human readable message format enables debugging.

Finally, XML is not the only game in town. JSON is becoming popular as an XML alternative. Protocol Buffers is Google's messaging protocol and has a good overview on some of the problems and Google's solution.




回答2:


The main benefit of using XML in this situation is that you remove the dependency on having the same software stack at both ends of the communication.

I once came across a client who was exchanging data with a key supplier by creating a daily image of their SQL server database at one end, and restoring it at the other. Consequence: neither party could upgrade to a new verion of SQL server unless the other party also upgraded on the same day.

Further, as O'Connor also mentioned, XML makes it relatively painless to extend the message contents as requirements change, without everyone having to implement the change simultaneously.



来源:https://stackoverflow.com/questions/10368343/what-is-benefit-of-sending-xml-using-jms

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!