views:

298

answers:

1

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 e.g. 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?

+1  A: 

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.

Igal Serban
Thank you I'll give that a try and get back to you.
ChrisBD
Yep looks as if that's the way to go.
ChrisBD