The AdminQueueInfo property specifies the queue used for MSMQ-generated acknowledgment messages. This object is passed to the Queue Manager on the target machine.
Type: | MSMQQueueInfo |
Run time: | read/write |
set object1.AdminQueueInfo = object2
Syntax Element | Description |
object1 | Message (MSMQMessage) object that represents the message. |
object2 | Queue information (MSMQQueueInfo) object that represents the administration queue. |
MSMQQueueInfo object.
Acknowledgment messages are sent to the administration queue by MSMQ. For information on acknowledgment messages and administration queues, see Acknowledgment Messages and Administration Queues.
The sending application indicates that it wants MSMQ to return acknowledgment messages by attaching Ack and AdminQueueInfo to the message.
The receiving application can determine if MSMQ is sending acknowledgments back to the sending application by examining Ack and AdminQueueInfo when reading the message in the queue.
For a complete discussion of sending messages that return acknowledgment messages, see Sending Messages that Request Acknowledgments.
This example uses an administration queue to see if a message reaches its destination queue. It sends a message and then reads the acknowledgment message (returned by MSMQ) to see if the original message reached its destination. The destination and administration queues are created if they don't exist.
To try this example using Microsoft Visual Basic (version 5.0), paste the code into the code window of a form, and then run the example and click the form.
Dim query As New MSMQQuery Dim qinfos As MSMQQueueInfos Dim qinfoAdmin As MSMQQueueInfo Dim qinfoDest As MSMQQueueInfo Dim q As MSMQQueue Dim msgSent As New MSMQMessage Private Sub Form_Click() '********************************** ' Locate administration queue '(create one if one doesn't exist). '********************************** Set qinfos = query.LookupQueue(Label:="Administration Queue") qinfos.Reset Set qinfoAdmin = qinfos.Next If qinfoAdmin Is Nothing Then Set qinfoAdmin = New MSMQQueueInfo qinfoAdmin.PathName = ".\AdminQueue" qinfoAdmin.Label = "Administration Queue" qinfoAdmin.Create End If '********************************** ' Locate destination queue '(create one if one doesn't exist). '********************************** Set qinfos = query.LookupQueue(Label:="Destination Queue") qinfos.Reset Set qinfoDest = qinfos.Next If qinfoDest Is Nothing Then Set qinfoDest = New MSMQQueueInfo qinfoDest.PathName = ".\DestQueue" qinfoDest.Label = "Destination Queue" qinfoDest.Create End If '************************ ' Open destination queue. '************************ Set q = qinfoDest.Open(MQ_SEND_ACCESS, MQ_DENY_NONE) '************** ' Send Message. '************** msgSent.Label = "Test Message" msgSent.Body = "This message tests acknowledgment messages." msgSent.Ack = MQMSG_ACKNOWLEDGMENT_FULL_REACH_QUEUE Set msgSent.AdminQueueInfo = qinfoAdmin msgSent.Send q MsgBox "The message was sent. Check the MSMQ Explorer to see the messages in the queue." q.Close '************************************ ' Read acknowledgment message in the ' administration queue. '************************************ Set q = qinfoAdmin.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE) Set msgAdmin = q.Receive If msgAdmin.Class = MQMSG_CLASS_ACK_REACH_QUEUE Then MsgBox "The message reached the queue." Else MsgBox " The message did not reach the queue." End If End Sub
Body, Class, Close, Create, Label, LookupQueue, MSMQMessage, MSMQQuery, MSMQQueue, MSMQQueueInfo, MSMQQueueInfos, Next, Open, PathName, Receive, Reset, Send