[rabbitmq-discuss] Different objects being passed thru RabbitMQ

Dave Curylo curylod at asme.org
Fri Aug 17 21:02:49 BST 2012

On Fri, Aug 17, 2012 at 3:44 PM, Wizaerd <wizaerd at gmail.com> wrote:

> I had tried adding a custom header to the headers collection with the
> Type, but RabbitMQ threw an error, and I was never able to get the Type to
> pass thru, plus there was no way to dynamically deserialize into the Type
> of object.  Unfortunately, the Type of object is not going to be acceptable.

You probably can't pass the Type itself into the header, but you should be
able to pass in the fully qualified type name as a string.

var props = model.CreateBasicProperties();
props.Headers["type"] = typof(User).AssemblyQualifiedName;

Then on the other end, you should be able to get out the type name, use
Type.GetType(typeName, true) to load the type, and perform deserialization
as usual.

> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120817/f28754d2/attachment.htm>

More information about the rabbitmq-discuss mailing list