AspNet.sk     Diskusné fóra     Vitajte v QuickStarts     ASP.NET     Silverlight     Ako môžem...? (en)     Class prehliadač Príklady chcem v ...   
Menu
Skip Navigation Links.

How Do I...? Common Tasks QuickStart Tutorial

How Do I...Use message formatters?



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 use different serialization mechanisms to send objects through a message queue. To run the sample you have to have Message Queuing installed on your system.

Selecting a serialization mechanism is as simple as changing the value of one property. Here are some examples:
  1. Send a message using an XML based serialization mechanism:

    
    mq.Formatter = New XmlMessageFormatter()
    mq.Send(order)
    
    VB


  2. Send a message using a binary serialization mechanism:

    
    mq.Formatter = New BinaryMessageFormatter()
    mq.Send(order)
    
    VB


  3. Send a message using a serialization mechanism which is compatible with the MSMQ ActiveX Formatter:

    
    mq.Formatter = New ActiveXMessageFormatter()
    mq.Send(order)
    
    VB

Example

VB Formatters.exe
View Source

[This sample can be found at H:\Home\WU_000036_efe47225c86ca62f325a01d8519bc002\Webs\aspnet.sk\quickstarts\QuickStartv20\howto\samples\Services\MessageQueue\Formatters\
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.


Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright © 2005 Microsoft Corporation. All rights reserved.
Preklad do slovenského jazyka - Copyright © 2005 - 2007 www.aspnet.sk, www.qsh.sk
Pošlite komentár k tejto stránke
Copyright © 2002 - 2008 Chastia, spol. s r. o., Igor Stanek, Designed by Lacino
Portál je hostovaný na serveroch firmy Quantasoft - www.qsh.sk.