Article ID: 179016
Article Last Modified on 7/13/2004
Dim qinfo As New MSMQQueueInfo Dim q As MSMQQueue Dim m As New MSMQMessage qinfo.PathName = "MachineName\TransactionalQueueName" Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE) m.Send q, MQ_SINGLE_MESSAGE q.CloseUsing C API, set the pTransaction parameter to MQ_SINGLE_MESSAGE. The following code uses the "Sending Messages Using an Internal Transaction" example from the SDK; it demonstrates an explicit internal transactional send and modifies it for the implicit semantics:
void TransactSend(QUEUEHANDLE h, MQMSGPROPS * pMsgProps)
{
HRESULT hr;
printf ("\nStarting transaction...\n\n");
//////////////////////////////////////
// Call MQSendMessage to send a transactional message to
// the destination queue.
//////////////////////////////////////
hr = MQSendMessage(h, // Handle to dest queue
&msgprops, // Pointer to MQMSGPROPS
MQ_SINGLE_MESSAGE); // Implicit internal
// transactional message.
if (FAILED(hr))
{
printf("\nFailed in MQSendMessage(). hresult- %lxh\n", (DWORD) hr) ;
}
else
{
printf ("Committing the transaction... ");
}
}
Additional query words: programming interface
Keywords: kbhowto KB179016