home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / TransactedDelivery_VBScript.asp < prev    next >
Text File  |  1997-10-25  |  3KB  |  103 lines

  1. <%@ TRANSACTION=REQUIRED LANGUAGE=VBScript %>
  2. <%  Option Explicit                        %>
  3.  
  4. <HTML>
  5.     <HEAD>
  6.         <TITLE>Transacted MSMQ Transmission</TITLE>
  7.     </HEAD>
  8.  
  9.     <BODY bgcolor="white" topmargin="10" leftmargin="10">
  10.  
  11.         
  12.         <!-- Display Header -->
  13.  
  14.         <font size="4" face="Arial, Helvetica">
  15.         <b>Transacted MSMQ Transmission</b></font><br>
  16.       
  17.         <hr size="1" color="#000000">
  18.  
  19.         This sample demonstrates how to send a transacted asynchronous message using 
  20.         the Microsoft Message Queueing Server (MSMQ).  MSMQ is one of the components
  21.         that comes with the Windows NT 4.0 Option Pack.
  22.   
  23.         <p> For this example to work, MSMQ must be first be installed on the host machine.
  24.         Using the MSMQ Explorer, a queue named "IIS_SDK_TRANSACTED" should then be created.  
  25.         Please click the "transacted" option when creating the queue.
  26.  
  27.         <p>After the example is run, return to the MSMQ Explorer and select "Refresh" from
  28.         the "View" menu.  The recently sent message will then appear within the "IIS_SDK_TRANSACTED"
  29.         queue.
  30.  
  31.         <%
  32.             Dim QueueInfo
  33.             Dim Queue
  34.             Dim Msg
  35.  
  36.  
  37.             ' Create MSMQQueueInfo Component to Open
  38.             ' MessageQueue
  39.  
  40.             Set QueueInfo = Server.CreateObject("MSMQ.MSMQQueueInfo")
  41.  
  42.  
  43.             ' Open Queue.  The queue could be physically located
  44.             ' on any machine.  The period in the line below indicates
  45.             ' that the queue is located on the local machine.
  46.  
  47.             QueueInfo.pathname = ".\IIS_SDK_TRANSACTED"
  48.             Set Queue = QueueInfo.Open(2, 0)
  49.  
  50.  
  51.             ' Create Message Component for Queue
  52.             
  53.             Set Msg = Server.CreateObject("MSMQ.MSMQMessage")
  54.  
  55.  
  56.             ' Construct Message.  Anything can be passed into both
  57.             ' the body and label.  The developer is responsible
  58.             ' for marshalling all arguments.  Note that the
  59.             ' delivery property has been sent to "Recoverable".
  60.             ' This will guarentee that the message will survive
  61.             ' a crash or shutdown on the queue machine.
  62.             
  63.             Msg.body = "This is the message body"
  64.             Msg.Label = "This is the message label"
  65.             Msg.Delivery = 1
  66.  
  67.  
  68.             ' Send Message
  69.             
  70.             Msg.Send Queue
  71.  
  72.  
  73.             ' Close Queue
  74.             
  75.             Queue.Close
  76.         %>
  77.  
  78.     </BODY>
  79. </HTML>
  80.  
  81. <% 
  82.     ' The Transacted Script Commit Handler.  This function
  83.     ' will be called if the transacted script commits.
  84.  
  85.     Sub OnTransactionCommit
  86.     
  87.         Response.Write "<p><b>The Transaction just comitted</b>."
  88.         Response.Write "The MSMQ message was <b>successfully</b> sent"
  89.  
  90.     End Sub
  91.  
  92.  
  93.     ' The Transacted Script Abort Handler.  This function
  94.     ' will be called if the script transacted aborts
  95.  
  96.     Sub OnTransactionAbort
  97.     
  98.         Response.Write "<p><b>The Transaction just aborted</b>."
  99.         Response.Write "The MSMQ message was <b>not</b> sent"
  100.     
  101.     End Sub
  102. %>
  103.