Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   |   Class Browser
  |   I want my samples in...   

How Do I...? Common Tasks QuickStart Tutorial

Go To...

How Do I...Pass a complex type through a message queue?

Message queuing makes it easy for application developers to communicate with application programs quickly and reliably by sending and receiving messages. Messaging provides you with guaranteed message delivery and a robust, fail-safe way to carry out many of your business processes.

The MessageQueue component allows you to easily incorporate message-based communication into your applications. Using this component and its associated language features, you can send and receive messages, explore existing queues, create and delete queues, and perform a variety of other operations using a simple programming model.

The sample illustrates how to use the MessageQueue component to send a complex type through a message queue. To run the sample you have to have Message Queuing installed on your system.

Sending a complex type through a queue is very simple. It is actually as simple as sending a string (see MQSend sample). The MessageQueue component handles everything automatically. All you have to do is:
  1. Create an instance of the MessageQueue component and set its Path property:

    		
    MessageQueue mq = new MessageQueue(".\\MyQueue");
    
    C#


  2. Calling Send method to send a complex object:

    		
    MyComplexType myType = new MyComplexType();
    mq.Send(myType);
    
    C#

Example

C# SendObject.exe
View Source

[This sample can be found at M:\web\users\Sites\AspnetQuickStart\v2.0\QuickStart\howto\samples\Services\MessageQueue\SendObject\
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin directory.]






Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.


Hosted by MaximumASP | Found a broken link? | Contact Us | Terms and conditions | Privacy Policy | Advertise with us
� 2000 - 2008  Mindcracker LLC. All Rights Reserved