| Previous | Next |
| MQ_ERROR_TRANSACTION_IMPORT | MQ_ERROR_TRANSACTION_SEQUENCE |
MQ_ERROR_TRANSACTION_USAGE
Operational meaning
Applications should keep MQ_ERROR_TRANSACTION_USAGE attached to the exact MSMQ call that produced it; translating it immediately to “queue error” discards the diagnostic boundary. In this case the decisive subject is queue operation violates transaction rules. Common boundaries include transactional versus nontransactional queues, local receive requirements, and using a transaction where none is permitted.
For MQ_ERROR_TRANSACTION_USAGE, A transaction error can occur before enlistment, during resource-manager participation, or after the application has issued work but before the outcome is durable. When diagnosing MQ_ERROR_TRANSACTION_USAGE, retry policy must account for an uncertain commit result.
Transaction identifiers and completion ownership are essential. In the MQ_ERROR_TRANSACTION_USAGE path, two threads attempting to commit, abort, or consume the same locked message can turn a recoverable application bug into duplicate processing.
Where to draw the boundary
| Subsystem | MSMQ internal or coordinated transactions and their MS DTC enlistment |
|---|---|
| Decisive boundary | transaction type, queue locality, operation order, and enlistment state determine whether the action is legal |
| Code-specific focus | queue operation violates transaction rules |
| Primary recovery rule | Correct the transaction/queue combination rather than retrying the same call. |
When diagnosing MQ_ERROR_TRANSACTION_USAGE, A transport retry is not equivalent to transaction recovery. In the MQ_ERROR_TRANSACTION_USAGE path, first determine whether the unit of work committed, aborted, remains in doubt, or never enlisted. For MQ_ERROR_TRANSACTION_USAGE, the code-specific boundary is queue operation violates transaction rules.
Evidence to preserve
- Begin, enlist, send/receive, prepare, commit, and abort timestamps; associate it explicitly with
MQ_ERROR_TRANSACTION_USAGE. - When diagnosing
MQ_ERROR_TRANSACTION_USAGE, transaction identifier and whether it is internal, ambient, or dtc-coordinated; capture the value before cleanup or retry changes it. - In the
MQ_ERROR_TRANSACTION_USAGEpath, queue transactional flag and local/remote placement; compare it with a known-good call using the same account and queue type. - For this
MQ_ERROR_TRANSACTION_USAGEresult, record the queue path or format name, local/remote placement, transactional flag, caller SID, process build, and UTC correlation ID when they apply.
For MQ_ERROR_TRANSACTION_USAGE, log certificate thumbprints, provider names, SIDs, GUIDs, lengths, and hashes where useful, but do not log private keys, symmetric keys, credentials, or confidential message bodies.
Diagnostic sequence
- Record the unsigned HRESULT,
MQ_ERROR_TRANSACTION_USAGE, and the native API or COM method before a framework replaces it with a generic exception. - When diagnosing
MQ_ERROR_TRANSACTION_USAGE, capture transaction identifier and whether it is internal, ambient, or DTC-coordinated. - In the
MQ_ERROR_TRANSACTION_USAGEpath, capture queue transactional flag and local/remote placement. - Reproduce with the smallest queue/message/property set that still returns
MQ_ERROR_TRANSACTION_USAGE; change one precondition at a time. - For
MQ_ERROR_TRANSACTION_USAGE, verify the postcondition after the failed call: queue existence, message presence, directory object state, transaction outcome, or generated output may differ by result. - When diagnosing
MQ_ERROR_TRANSACTION_USAGE, apply the code-specific recovery rule: Correct the transaction/queue combination rather than retrying the same call.
Handling and recovery
Correct the transaction/queue combination rather than retrying the same call.
When diagnosing MQ_ERROR_TRANSACTION_USAGE, an immediate loop around the same call is not recovery. In the MQ_ERROR_TRANSACTION_USAGE path, define who owns cancellation, handle recreation, transaction reconciliation, and duplicate suppression before another attempt is issued.
Nearby failure boundaries
In the MQ_ERROR_TRANSACTION_USAGE path, do not convert the operation to a nontransactional send merely to suppress the HRESULT; that changes delivery and atomicity guarantees. The specific focus for MQ_ERROR_TRANSACTION_USAGE remains queue operation violates transaction rules.
- In the
MQ_ERROR_TRANSACTION_USAGEpath, restarting MSMQ before collecting evidence can invalidate handles and erase the first useful event; it is a containment action, not a root-cause diagnosis. - For this
MQ_ERROR_TRANSACTION_USAGEresult, granting broad queue or certificate permissions may mask the symptom while creating a security defect. ForMQ_ERROR_TRANSACTION_USAGE, test the exact identity and access needed by the operation.
Worked example
A transactional receiver encounters MQ_ERROR_TRANSACTION_USAGE. For MQ_ERROR_TRANSACTION_USAGE, it correlates the MSMQ call with the DTC transaction ID and final outcome before replaying business work. When diagnosing MQ_ERROR_TRANSACTION_USAGE, the acceptance test then changes only the decisive precondition and confirms both the HRESULT and the actual queue/message state.
Automated coverage should preserve the original arrays/identities, confirm that cleanup is safe after MQ_ERROR_TRANSACTION_USAGE, and test that a retry does not duplicate messages or directory objects.
References
- Microsoft: enable MS DTC diagnostic tracing — source used for the
MQ_ERROR_TRANSACTION_USAGEanalysis. - Microsoft: destination queues — source used for the
MQ_ERROR_TRANSACTION_USAGEanalysis. - Microsoft: Message Queuing error and information codes — source used for the
MQ_ERROR_TRANSACTION_USAGEanalysis. - Microsoft: MSMQTransaction.Commit and transaction model links — source used for the
MQ_ERROR_TRANSACTION_USAGEanalysis. - Microsoft: DTC Developers Guide — source used for the
MQ_ERROR_TRANSACTION_USAGEanalysis.
Looking for a different code? Search another status or error code.