home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / howto / doc / mqsend.aspx < prev    next >
Encoding:
Text File  |  2000-06-08  |  3.7 KB  |  72 lines

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Send a message to a message queue?</h4>
  5.  
  6. <div class="indent" style="width:660">
  7. <p style="margin-right: 0; margin-top: 6; margin-bottom: 5"><font face="Tahoma" size="1">Message queuing makes 
  8. it easy for application developers to communicate with application programs quickly and reliably by sending and 
  9. receiving messages. Messaging provides you with guaranteed message delivery and a robust, fail-safe way to carry 
  10. out many of your business processes.<br>
  11. <br>
  12. The MessageQueue component allows you to easily incorporate message-based communication into your applications. 
  13. Using this component and its associated language features, you can send and receive messages, explore existing 
  14. queues, create and delete queues, and perform a variety of other operations using a simple programming model.<br>
  15. <br>
  16. The sample illustrates how to use the MessageQueue component to send a simple
  17. message to a message queue. To run the sample you have to have Message Queuing
  18. installed on your system. The sample is a command line application that takes
  19. two command line arguments. The first argument is a name of a message
  20. queue. The path does not have to refer to an existing queue. If the queue does
  21. not exist, it will be created for you. The second command line argument is the
  22. message to be written to the queue. For example you can run it as follows:<br>
  23. <br>
  24. </font><font color="#0000FF" face="Courier New" size="2">   
  25. > MQSend.exe MyQueue "Hello World!"</font><font face="Tahoma" size="1"><br>
  26. <br>
  27. Now, open the Message Queuing console and examine the MyQueue message queue. It
  28. should have a message in it.<br>
  29. <br>
  30. In its simplest form, sending a message to a message queue involves:</font></p>
  31. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
  32. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="1">1.
  33. Creating an instance of the MessageQueue component and setting its Path
  34. property:</font></p>
  35. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
  36. <blockquote>
  37.   <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="Courier New" size="2" color="#0000FF">MessageQueue
  38.   mq = new MessageQueue(".\\MyQueue");</font></p>
  39. </blockquote>
  40. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
  41. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="1">2.
  42. Calling Send method to send the message:</font></p>
  43. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"> </p>
  44. <blockquote>
  45.   <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="Courier New" size="2" color="#0000FF">mq.Send("Hello
  46.   World!");</font></p>
  47. </blockquote>
  48. <p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="1">Have
  49. a good time MessageQueue'ing!</font>
  50. </div>
  51.  
  52. <h4>Example</h4>
  53.  
  54. <p>
  55. <div class="indent">
  56. <a target="_blank" href="/quickstart/howto/samples/Services/MessageQueue/MQSend">
  57. <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
  58. </a>
  59. <div class="caption">MQSend.exe</div><br>
  60. [<a target="_blank" href="/quickstart/howto/samples/Services/MessageQueue/MQSend">View Sample</a>] | 
  61. [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/MessageQueue/MQSend/MQSend.src">View Source</a>]<p>
  62. </div>
  63.  
  64. <h4>Source Code</h4>
  65.  
  66. <div class="code">
  67. <xmp>
  68. <!-- #include virtual="/quickstart/howto/samples/Services/MessageQueue/MQSend/MQSend.cs" -->
  69. </xmp>
  70. </div>
  71.  
  72. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->