all groups > dotnet academic > january 2005 >
You're in the

dotnet academic

group:

MSMQ problem



MSMQ problem Laszlo Csabi
1/25/2005 1:05:14 PM
dotnet academic: Hi Folks,

I got a problem with message queue. I want to put a row of a dataset into
the message body and when I send it to the Q I throws an Exception.

Error message is : YNOTCALLME.MULTISOFT.ENTITY.dsDistributor.DistributorRow
cannot be serialized because it does not have a default public constructor

I have the following methos which throw the exception:

private void
Send2VoiceRoomQ(YNOTCALLME.MULTISOFT.ENTITY.dsDistributor.DistributorRow
row)

{

try

{

if(MessageQueue.Exists(VOICEQ))

{

//creates an instance MessageQueue, which point to the already existing
MyQueue

mqv = new System.Messaging.MessageQueue(VOICEQ);

}

else

{

//creates a new private queue called VOICEQ

mqv = MessageQueue.Create(VOICEQ);

}

mqv.Formatter = new System.Messaging.XmlMessageFormatter();

for ( int i=0; i < dsDistibutor.Distributor.Rows.Count ; i++ )

{

System.Messaging.Message mm = new System.Messaging.Message();

mm.Label = row["dm_lname"].ToString () + " " + row["dm_fname"].ToString () ;

mm.Body = row;

mqv.Send(mm);

}

}

catch( Exception ex )

{

FRAMEWORK.ERRORMANAGER.Error.Save (ex.Message,ex.Source ,ex.StackTrace ,"");

}

}

What I would like to achive is put a row of the dataset into the message and
send it to the MSMQ.

Any idea if is that possible?



Thanks



Laszlo

Re: MSMQ problem Alvin Bruney [Microsoft MVP]
2/26/2005 2:13:14 PM
You cannot send objects that aren't serializeable. One workaround is to
parse the contents of the row as a delimited string and send the string. Or
you can try subclassing the row object to implement a serializer but that
sounds like useless work to me.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------


[quoted text, click to view]

AddThis Social Bookmark Button