[rabbitmq-discuss] Different objects being passed thru RabbitMQ

Alexander Ward alexander.ward at quibids.com
Fri Aug 17 20:51:15 BST 2012


You could just make a generic object that you are sending to rabbit with 2
properties, one being the type of object you're sending, and the other
being the actual serialized object. You'd have to update your consumers to
be able to handle that though.

It might be better to just send json though, so you'd be working with
something that could have dynamic properties.

-Alex

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

> I'm working well with RabbitMQ thus far, however I have a question about
> how to approach something.  Right now I have a series of consumer
> applications that knows exactly what type of serislaized object is coming
> to the queue, as they are specialized for the specific object types to
> process.  However, the architect wants a more generic listener that pull
> messages from the queue, but the messages body would be a different type of
> serialized object.  for example it could be a User object, or a Course
> object, etc...  In my listener, what is the best way to dynamically
> determine the type of object being passed in, thus being able to
> deserialize it and work with it?  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.
>
> Anyone have any suggestion I could try and/or research?
>
> _______________________________________________
> 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/fa683841/attachment.htm>


More information about the rabbitmq-discuss mailing list