[rabbitmq-discuss] Sending messages with abstract types as properties

Kayode Leonard kLeonard at elliottmgmt.com
Fri Oct 26 15:00:46 BST 2012


Will do,
Thanks

-----Original Message-----
From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Tim Watson
Sent: Thursday, October 25, 2012 8:59 PM
To: Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] Sending messages with abstract types as properties

s/however/whoever/

On 26 Oct 2012, at 01:57, Tim Watson wrote:

> Hi
>
> On 25 Oct 2012, at 22:36, kayslay wrote:
>
>> I have a message that I'm sending and one of it's properties is an abstract type.  When I send this message I get an exception on the receiver from the json serializer:
>> How am I able to receive a message that has an interface or abstract type property, here MyPayload is an abstract class?
>> Thanks
>> Exception:
>> Newtonsoft.Json.JsonSerializationException: Could not create an
>> instance of type MyNamespace.Payloads.MyPayload. Type is an interface
>> or abstract class and cannot be instantated. Path 'Payload.Id', line
>> 1, position 17.
>
> This is really a question for however supplies the Newtonsoft.Json package. I know that with some serialisation frameworks this just works transparently, because the framework 'bakes' the concrete classname into the representation at runtime, but gives you back a reference to the type you're expecting. Some frameworks allow you do write serialize/deserialize hooks to do this as well. Generics add a bit more complexity.
>
> Either way, this hasn't really got anything to do with RabbitMQ so I'd suggest contacting the author on github, assuming it is https://github.com/mikehadlow/EasyNetQ that we're talking about.
>
> Cheers,
> Tim
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


Confidentiality Notice from Elliott Management Corporation:

The information contained in this e-mail and any attachments may be legally privileged, proprietary and/or confidential. If you are not an intended recipient, you are hereby notified that any use, copying, disclosure or distribution of all or any portions of this e-mail and any attachments is strictly prohibited. If you received this e-mail in error, please notify the sender, permanently delete the e-mail and any attachments, and destroy all hard copies immediately.

No warranty is made as to the completeness or accuracy of the information contained in this communication. Any views or opinions presented are those of only the author and do not necessarily represent those of Elliott Management Corporation or its related entities. This communication is for information purposes only and should not be regarded as an offer, solicitation or recommendation to sell or purchase any security or other financial product.

Elliott Management Corporation and its related entities reserve the right to monitor all e-mail communications through their networks.

Thank you.


More information about the rabbitmq-discuss mailing list