简体   繁体   中英

Is it possible to capture MSMQ messages from a private queue or add a second destination?

The project that I'm working on uses a commercially available package to route audio to various destinations. With this package is a separate application that can be used to log events generated by the audio routing software to a database eg connect device 1 to device 3.

I have been tasked with writing an application that reacts to specific events generated by the audio routing software such as reacting to any connections to device 3.

I have noted that the audio routing sofware uses MSMQ to post event information to the event recorder. This means that event data can build up if the recorder software has not run for a while.

I have located the queue - ".\\private$\\AudioLog" and would like to perform the following actions:

  1. Detect and process new messages as they are entered onto the queue.

  2. Allow the current event recording software to continue to work as before - therefore messages can not be removed by my application.

  3. Ensure that I always get to see a message.

Now I note that I can use MessageQueue to Peek at the queue in order to read messages without deletion and also GetAllMessages() to peek at all messages not removed by the event recorder.

If the recording software isn't connected then I can see that I can gather message data easily enough, but I can't see how I can ensure that I get to see a message before the recorder removes a message when it is connected.

Ideally I would like to add my application as a second destination for the message queue. Is this possible programmatically?

If not as I have administrator privilege, access to the machine with the queue is it possible to configure the queue manually to branch a second copy of the queue to which I can connect my software?

Msmq has a journaling feature. You can configure the queue to have a journal. Then, every message that is removed from the queue( by a read operation) is moved to the journal queue and not deleted. You can then read (or peek) from the journal. If you are using peek operation, make sure that you have a job that delete the journal from time to time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM