471,321 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

MessageQueues that pass an object with another object in it.

UJ
I have an object I'm using to pass around data using a messagequeue. It has
a small header in it and then a reference to a variable of type object. I do
this so that I can have a generic message that everybody uses. My message
router looks at the object, sees who it needs to go to and forwards it
along. The recipient knows how to decode it.

Problem is, when I make the object a class of my own creation, I get an
error. It says "There was an error generating the XML document.".

Anybody have any ideas? I guess I could use the objects directly and stick
in it who it is going to.

TIA - Jeff.

Jan 30 '06 #1
1 1143
You need to serialize the objects and assign them to the Message Body, and
then deserialize ("unwrap") your outer class for routing, then at the
receiving end, the inner payload class. Try using the
BinaryMessageFormatter, its more efficient than Xml which generates a larger
payload.

What I do is use the BinaryFormatter to serialize the inner class to byte[]
and assign this to the Payload property of the outer "Routing" message.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
I have an object I'm using to pass around data using a messagequeue. It has
a small header in it and then a reference to a variable of type object. I do
this so that I can have a generic message that everybody uses. My message
router looks at the object, sees who it needs to go to and forwards it
along. The recipient knows how to decode it.

Problem is, when I make the object a class of my own creation, I get an
error. It says "There was an error generating the XML document.".

Anybody have any ideas? I guess I could use the objects directly and stick
in it who it is going to.

TIA - Jeff.

Jan 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by z_learning_tester | last post: by
1 post views Thread by UJ | last post: by
5 posts views Thread by David++ | last post: by
28 posts views Thread by Bill | last post: by
275 posts views Thread by Astley Le Jasper | last post: by
45 posts views Thread by =?Utf-8?B?QmV0aA==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.