使用jms发送xml有什么好处 [英] what is benefit of sending xml using jms

查看:186
本文介绍了使用jms发送xml有什么好处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前项目中,我们一直在使用jms将xml作为文本消息发送.我不明白为什么他们不只是发送Objectmessage,为什么还要处理xml的开销?

所以问题基本上归结为为什么在jms中使用xml?

解决方案

所有这些都归结为关于消息序列化格式的设计决策.

起初,Objectmessage似乎是最有效的机制.但是,在以下情况下它不能很好地工作:

  1. 消息验证(XML模式充当消息合同的一种形式)
  2. 发送方和接收方之间的软件版本差异(消息版本控制)
  3. 与非Java系统的通信

以XML序列化消息并不能完全解决这些问题,但是某种形式的人类可读消息格式可以进行调试.

最后,XML不是唯一的游戏. JSON作为XML的替代品正变得越来越流行. 协议缓冲区是Google的消息协议,并且很好地概述了一些问题和Google的解决方案. >

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 ?

解决方案

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.

这篇关于使用jms发送xml有什么好处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆