Share via


How to: Create Transactional Queues

A transactional queue is created for the specific purpose of receiving and processing messages that are sent as part of a transactional activity. Nontransactional queues are unable to process messages that have been included in a transactional activity.

To send messages as part of a transactional activity, the receiving queue must be set to process transactions. This can be done programmatically by setting its Transactional property to true.

To create a transactional queue

  1. Add a reference to System.Messaging.dll. For more information, see How to: Add or Remove References in Visual Studio (Visual Basic).

  2. Use the overloaded Create constructor to create a public, transactional queue, setting the second parameter to true to indicate that the queue should be transactional.

    Dim MessageQueue1 As New System.Messaging.MessageQueue
    MessageQueue1 = System.Messaging.MessageQueue.Create(".\MyTransQueue", True)
    
         System.Messaging.MessageQueue MessageQueue1 =
               new System.Messaging.MessageQueue();
            MessageQueue1 = System.Messaging.MessageQueue.Create(".\\MyTransQueue", true);
    

    Note

    This syntax creates a public transactional queue. The exact syntax you use in the first parameter depends on the kind of queue you are trying to create. For more information, see Queue Reference Recommendations.

See Also

Tasks

How to: Send Messages Within Internal Transactions

How to: Create Queues

How to: Add or Remove References in Visual Studio (Visual Basic)

Concepts

Transactional Message Processing

Queue Reference Recommendations

Other Resources

Reading and Receiving Messages