Microsoft KB Archive/258260

= How To Use the COM+ MSMQ Message Mover Utility =

Article ID: 258260

Article Last Modified on 2/23/2007

-

APPLIES TO


 * Microsoft COM+ 1.0
 * Microsoft Message Queuing 2.0

-



This article was previously published under Q258260



SUMMARY
This article describes how to use the Message Mover utility that is included in COM+ 1.0.



MORE INFORMATION
The Message Mover object is a utility that moves MSMQ messages from a source queue to a destination queue.

If the messages are generated by COM+ Queued Components calls, Message Mover preserves the original caller's security identifier as it moves messages between queues.

If both queues are transacted, the entire operation is done transactionally. If either the source or destination queues are not transacted, the operation does not run under a transaction. An unexpected failure (such as a crash) and restart of a nontransactional move could duplicate the message being moved at the time of the failure.

To use the Message Mover utility from Microsoft Visual Basic, add a reference to the "COM+ Services Type Library." You can also use this automation object a script written in Visual Basic Scripting Edition, JavaScript, ASP pages, and C++ clients.

The following sample code shows how to create the object, set the required properties, and then initiate the transfer: Dim oMessageMover Dim lMessagesMoved

Set oMessageMover = CreateObject("QC.MessageMover")

oMessageMover.SourcePath = ".\TheSourceQueue" oMessageMover.DestPath = ".\TheDestinationQueue"

lMessagesMoved = oMessageMover.MoveMessages

MsgBox lMessagesMoved & " messages moved from '" &  oMessageMover.SourcePath &  "' to '" & oMessageMover.DestPath & "'." Note that the SourcePath and DestinationPath properties require MSMQ path names. To move messages from or to private queues, prefix the queue name in the path with Private$\. Please read the documentation in the "References" section for detailed information about the path name format.

