我是使用RabbitMQ 的春天AMQP的新人。 我知道这个问题涉及一个更广泛的问题。 我想将一个对象列表存储到可以发送给消费者的信息中。 任何人都能为这一问题提供简单的解决办法吗?
我知道序列化可以是一个解决方案,但对于我使用的简单应用程序来说,这将会是超乎寻常的。 信息在性质上将是无与伦比的。 还有其他办法吗?
我是使用RabbitMQ 的春天AMQP的新人。 我知道这个问题涉及一个更广泛的问题。 我想将一个对象列表存储到可以发送给消费者的信息中。 任何人都能为这一问题提供简单的解决办法吗?
我知道序列化可以是一个解决方案,但对于我使用的简单应用程序来说,这将会是超乎寻常的。 信息在性质上将是无与伦比的。 还有其他办法吗?
AMQP 只支持一种类型的消息 - 二进制( 位元) - 这意味着您必须按顺序排列对象 。
你确实可以选择序列化的类型, 不过-- 例如 JSON、 XML 或 Java 序列化 。
You can use a MessageConverter
, see the Spring RabbitMQ documentation:
http://static.springsource.org/spring-amqp/docs/1.1.x/reference/htmlsingle/#d4e293
有一个 JsonMessage Converter
可能是您正在寻找的。
我建议不要使用标准 Java 序列化和 < code> Supremesage Converter 标准,因为这样,你的执行将受 Java 的约束,这将挫败AMQPs 协议概念的整个概念。
文献资料:
With AMQP being a wire-level protocol, it would be unfortunate to lose
much of that advantage with such restrictions.
以下是从文档中摘取的代码示例:
<bean class="org.springframework.amqp.rabbit.core.RabbitTemplate">
<property name="connectionFactory" ref="rabbitConnectionFactory"/>
<property name="messageConverter">
<bean class="org.springframework.amqp.support.converter.JsonMessageConverter"/>
</property>
</bean>
一旦你设置了这个系统,就应该有可能将一个清单物体序列化或进行序列化,然后输入JSON和背部。
Ok, the context is some serialization / deserialization code that will parse a byte stream into an object representation that s easier to work with (and vice-versa). Here s a simplified example ...
Background Converting from using .Net Remoting to WCF. Most of the methods on the WCF server are working fine, but ran into one that isn t working today. This is the service contract: [...
Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...
I am using the below code snippet now to deserialize the XML document ... [WebMethod] public XmlDocument OrderDocument(XmlDocument xmlDoc) { XmlSerializer serializer = new XmlSerializer(typeof(...
how do I include the serialized data from a child class where both impliment iserializeable? Class A Implements ISerializable dim _B as new B Class B Implements ISerializable ...
Looking for some guidance on a WCF service I’m prototyping. I have a WCF service hosted in IIS that will pass data to my clients. I have a separate shared assembly that contains all my business ...
I m trying to improve the performance of my web app where a page does a long query to pull data from different tables on a database. It pulls invoice data with multiple item lines, invoice status, and ...
Is it possible to Deserialize the following piece of XML into a Dictionary<int,string> object? XML: <Config> <DatabaseConnections> <Connection Name="Source Connection" ...