简体   繁体   English

是否可以从专用队列中捕获MSMQ消息或添加第二个目的地?

[英]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. 带有此软件包的是一个单独的应用程序,可用于将由音频路由软件生成的事件记录到数据库,例如将设备1连接到设备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. 我的任务是编写一个对音频路由软件生成的特定事件做出反应的应用程序,例如对与设备3的任何连接做出反应。

I have noted that the audio routing sofware uses MSMQ to post event information to the event recorder. 我已经注意到,音频路由软件使用MSMQ将事件信息发布到事件记录器。 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: 我找到了队列-“。\\ private $ \\ AudioLog”,并想要执行以下操作:

  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. 现在,我注意到我可以使用MessageQueue来查看队列,以便读取消息而不删除,还可以使用GetAllMessages()来查看事件记录器未删除的所有消息。

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. Msmq具有日记功能。 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. 如果使用偷看操作,请确保您有不时删除日记帐的作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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