473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1195
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Vanessa | last post by:
Hi, I would like to know whether there's any way for me to pass an object by reference to another form? Regards Vanessa
3
by: Andrew Mueller | last post by:
Hello, I tried this question prior and got no response, so thought I would try to explain differently.. I am not sure which type of object to pass between a VB 6.0 ActiveX dll and C#. I am...
4
by: z_learning_tester | last post by:
I'm reading the MS press C# book and there seems to be a contradiction. Please tell me which one is correct, 1 or 2. Thanks! Jeff 1. First it gives the code below saying that it prints 0 then...
1
by: UJ | last post by:
Can you have the same messagequeue process messages that are of different types? TIA - Jeff.
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
28
by: Bill | last post by:
Hello All, I am trying to pass a struct to a function. How would that best be accomplished? Thanks, Bill
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
45
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.