COM+ Programming Design Considerations
Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista
The following is a summary of the design issues that you must consider when sending or receiving messages within a COM+ transaction (in Microsoft® Windows® 2000 or later) or an MTS transaction (in Microsoft Windows NT® 4.0 or earlier).
Queues used to receive transaction messages must be transactional. The property used to make a queue transactional can be set only when the queue is created.
When calling | Set |
---|---|
MQCreateQueue | The PROPID_Q_TRANSACTION property to MQ_TRANSACTIONAL. |
MSMQQueueInfo.Create | The IsTransactional parameter to TRUE. |
Message Queuing can detect and become part of the current COM+ transaction. When using Message Queuing functions you must explicitly specify the COM+ transaction. When using the Message Queuing COM components, Message Queuing joins the current COM+ transaction by default.
When calling | Set |
---|---|
MQSendMessage or MQReceiveMessage | The pTransaction parameter to MQ_MTS_TRANSACTION. |
You can call the IsInTransaction method to see if the current COM+ or MTS context is transactional. This is needed to make sure only transactional messages are sent to transactional queues.
If using | Use |
---|---|
Microsoft Windows 2000 or later | The ObjectContext::IsInTransaction method provided by COM+ (Component Services). |
When sending messages, you can make sure that only transactional messages are sent to transactional queues by changing the pTransaction parameter based on the state of the current COM+ context.
If the current MTS context is | Set pTransaction to |
---|---|
Transactional | MTS_TRANSACTION |
Nontransactional | MQ_SINGLE_MESSAGE |
It is possible to perform other types of transactions while running under COM+. To do this, set the pTransaction parameter of the sending or receiving call to a value other than MQ_MTS_TRANSACTION, such as MQ_SINGLE_MESSAGE or MQ_XA_TRANSACTION.
For information on | See |
---|---|
Sending Transactional Messages | Sending Messages to a Transactional Queue |
Retrieving Transactional Messages | Retrieving Messages from a Transactional Queue |
How messages are placed in the queue | Ordering of Messages in a Transactional Queue |