简体   繁体   English

EasyNetQ无法从使用RabbitMQ Java Client API发布的队列中读取消息

[英]EasyNetQ not reading messages from queue published with RabbitMQ Java Client API

We are using Coldfusion utilising the java RabbitMQ Client API to publish messages to a Queue, and then using EasyNetQ to read the messages from the queue using C#. 我们正在使用Coldfusion,利用Java RabbitMQ Client API将消息发布到队列,然后使用EasyNetQ使用C#从队列中读取消息。

The message is a string. 该消息是一个字符串。

The java Client is publishing messages as an unseralized bytearray with a content-type of text/plain. Java客户端将消息发布为具有文本/纯内容类型的未序列化字节数组。

When we try and read the message from the queue we always get a EasyNetQ.EasyNetQInvalidMessageTypeException thrown, no matter the type of the message as defined on the EasyNetQ side. 当我们尝试从队列中读取消息时,无论EasyNetQ端定义的消息类型如何,总是会抛出EasyNetQ.EasyNetQInvalidMessageTypeException。 I have tried it as byte array and just a basic object. 我已经尝试了它作为字节数组,只是一个基本的对象。 I think EasyNetQ is expecting a serialized object every time? 我认为EasyNetQ每次都希望有序列化的对象吗?

The exception we are getting is 我们得到的例外是

Message: 2344462 BasicProperties: (content-type=text/plain, content-encoding= , headers= , delivery-mode=1, priori ty=0, correlation-id= , reply-to= , expiration= , message-id= , timestamp= , typ e= , user-id= , app-id= , cluster-id=_) 消息:2344462基本属性:(content-type = text / plain,content-encoding = ,headers = ,交付模式= 1,优先级= 0,correlation-id = ,reply-to = ,到期时间= ,message-id = ,timestamp = ,typ e = ,user-id = ,app-id = ,cluster-id = _)

Exception: EasyNetQ.EasyNetQInvalidMessageTypeException: Message type is incorrect. 异常:EasyNetQ.EasyNetQInvalidMessageTypeException:消息类型不正确。 Expecte d 'System_Byte[]:mscorlib', but was '' 预期为'System_Byte []:mscorlib',但为”

Can anyone help please? 有人可以帮忙吗?

EasyNetQ expects a JSON serialized UTF-8 body representing the .NET type given in the subscription method and the 'type' field of basic properties to be populated with a EasyNetQ style type description. EasyNetQ期望一个JSON序列化的UTF-8主体,该主体表示订阅方法中给出的.NET类型,并且基本属性的“ type”字段将填充EasyNetQ样式类型描述。

You should use the Advanced API if you want to do your own de-serialization. 如果要自己进行反序列化,则应使用Advanced API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM