记录MQ消息 [英] Logging MQ Messages

查看:152
本文介绍了记录MQ消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将进入MQ队列的消息记录到数据库/文件或另一个记录队列中,但是我无法修改现有代码.是否有任何方法可以实现某种类似于HTTP嗅探器的消息记录实用程序?也许MQ有一些内置的功能来记录消息?

I want to log messages that come into MQ Queue to database/file or another logging queue and I can not modify existing code. Are there any methods to implement some kind of message logging utility that will act like HTTP sniffer? Or maybe MQ have some built-in finctionality to log messages?

预先感谢您的回答.

推荐答案

我认为可以通过创建指向主题的ALIAS QUEUE来实现.

I think this is possible by creating ALIAS QUEUE that points to a topic.

假定RECV.Q作为应用程序当前从中接收消息并处理的队列.

Assuming RECV.Q as the queue that your application currently receives messages from and processes.

1)首先创建一个主题,例如LOG.TO.DATABASE.
2)然后创建别名队列ALIAS.LOG.TO.DATABASE,将Base object设置为LOG.TO.DATABASE并将Base Type设置为Topic.
3)然后创建一个本地队列LOG.TO.DATABASE.Q
4)创建一个持久订阅,SUB.FOR.RECV.Q指向RECV.Q作为目的地.
5)创建另一个持久订阅SUB.FOR.LOG.TO.DABASE,该订阅指向LOG.TO.DATABASE.Q作为目的地

1) First create a topic, say LOG.TO.DATABASE.
2) Then create an alias queue ALIAS.LOG.TO.DATABASE with Base object set to LOG.TO.DATABASE and set Base Type as Topic.
3) Then create a local queue LOG.TO.DATABASE.Q
4) Create a durable subscription, SUB.FOR.RECV.Q that points to RECV.Q as destination.
5) Create another durable subscription SUB.FOR.LOG.TO.DABASE that points to LOG.TO.DATABASE.Q as destination

现在,发件人应用程序需要将消息放入ALIAS.LOG.TO.DATABASE.由于别名队列实际上指向主题,因此消息将发布到LOG.TO.DATABASE上.对于此主题,我们注册了两个订阅,因此两者都将收到相同的消息.您的使用者应用程序将继续按原样工作,而可以编写新的应用程序来处理来自其他订阅的消息.

Now the sender application need to put messages to ALIAS.LOG.TO.DATABASE. Since the alias queue actually points to topic, the messages gets published onto LOG.TO.DATABASE. To this topic we have two subscriptions registered, so both will get the same message. Your consumer application will continue to work as is whereas a new application can be written to process messages from other subscription.

这篇关于记录MQ消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆