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

1.6k Views Asked by At

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#.

The message is a string.

The java Client is publishing messages as an unseralized bytearray with a content-type of text/plain.

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. I have tried it as byte array and just a basic object. I think EasyNetQ is expecting a serialized object every time?

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=_)

Exception: EasyNetQ.EasyNetQInvalidMessageTypeException: Message type is incorrect. Expecte d 'System_Byte[]:mscorlib', but was ''

Can anyone help please?

1

There are 1 best solutions below

0
On

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.

You should use the Advanced API if you want to do your own de-serialization.