将自定义对象绑定到JMS MapMessage [英] bind a custom object to a JMS MapMessage

查看:140
本文介绍了将自定义对象绑定到JMS MapMessage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否可以使用标准方法将自己的自定义对象添加到Map,然后将其正确编组到MapMessage中?当前,我收到无效对象类型消息.我注意到WebSphere有一个解决方案,但是我正在寻找不受特定AS约束的东西,如果没有这种方法,也许JBoss支持的东西会起作用.

Is there a standard way for me to add my own custom object to a Map and then have it properly marshalled in a MapMessage? Currently I get the Invalid Object Type message. I noticed that WebSphere has a solution but I am looking for something that is not bound to a particular AS, if there is no such method, maybe something supported by JBoss would work.

如何在WebSphere中做到这一点:

How to do it in WebSphere: http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.websphere.wesb.doc/ref/rwesb_jmscustombindings.html

推荐答案

JMS映射消息的映射仅支持基元和字符串(及其数组)作为值. 从 javadoc :

A JMS map message's map only supports primitives and strings (and their arrays) as values. From the javadoc:

名称是String对象,值是原始数据类型 用Java编程语言.

The names are String objects, and the values are primitive data types in the Java programming language.

使用 ObjectMessage 并编写序列化对象会更好到地图,然后将地图作为ObjectMessage的有效内容发送.这样,您仍然可以使用名称/值映射访问样式,但不受类型的限制.

You would be better off using an ObjectMessage and write your serialized objects to a map and then send the map as the payload of the ObjectMessage. That way, you can still have the name/value map access style but without the limitation of types.

这篇关于将自定义对象绑定到JMS MapMessage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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