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

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Pass a complex type through a message queue?</h4>
  5.  
  6. <div class="indent" style="width:660">
  7. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Tahoma" size="1">Message
  8. queuing makes it easy for application developers to communicate with application
  9. programs quickly and reliably by sending and receiving messages. Messaging
  10. provides you with guaranteed message delivery and a robust, fail-safe way to
  11. carry out many of your business processes.<br>
  12. <br>
  13. The MessageQueue component allows you to easily incorporate message-based
  14. communication into your applications. Using this component and its associated
  15. language features, you can send and receive messages, explore existing queues,
  16. create and delete queues, and perform a variety of other operations using a
  17. simple programming model.<br>
  18. <br>
  19. The sample illustrates how to use the MessageQueue component to send a complex
  20. type through a  message queue. To run the sample you have to have Message
  21. Queuing installed on your system.<br>
  22. <br>
  23. Sending a complex type through a queue is very simple. It's actually as simple
  24. as sending a string (see MQSend sample). The MessageQueue component handles
  25. everything automatically. All you have to do is:</font></p>
  26. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"> </p>
  27. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Tahoma" size="1">1.
  28. Create an instance of the MessageQueue component and set its Path property:</font></p>
  29. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"> </p>
  30. <blockquote>
  31.   <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Courier New" color="#0000ff" size="2">MessageQueue
  32.   mq = new MessageQueue(".\\MyQueue");</font></p>
  33. </blockquote>
  34. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"> </p>
  35. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Tahoma" size="1">2.
  36. Calling Send method to send a complex object:</font></p>
  37. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"> </p>
  38. <blockquote>
  39.   <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Courier New" color="#0000ff" size="2">MyComplexType
  40.   myType = new MyComplexType();</font></p>
  41.   <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Courier New" color="#0000ff" size="2">mq.Send(myType);</font></p>
  42. </blockquote>
  43. <p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px"><font face="Tahoma" size="1">Have
  44. a good time MessageQueue'ing!</font></p>
  45.  
  46. </div>
  47.  
  48. <h4>Example</h4>
  49.  
  50. <p>
  51. <div class="indent">
  52. <a target="_blank" href="/quickstart/howto/samples/Services/MessageQueue/SendObject">
  53. <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
  54. </a>
  55. <div class="caption">SendObject.exe</div><br>
  56. [<a target="_blank" href="/quickstart/howto/samples/Services/MessageQueue/SendObject">View Sample</a>] | 
  57. [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/MessageQueue/SendObject/SendObject.src">View Source</a>]<p>
  58. </div>
  59.  
  60. <h4>Source Code</h4>
  61.  
  62. <div class="code">
  63. <xmp>
  64. <!-- #include virtual="/quickstart/howto/samples/Services/MessageQueue/SendObject/SendObject.cs" -->
  65. </xmp>
  66. </div>
  67.  
  68. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->