Logging MQ Messages

吃可爱长大的小学妹 提交于 2019-12-04 17:27:58

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

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

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

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.

Or you can use (free) open source project called Message Multiplexer (MMX) http://www.capitalware.biz/mmx_overview.html

If you need may queues to be logged/audited then you may want to look at MQ Auditor (it is a commercial product): http://www.capitalware.biz/mqa_overview.html

Here are commands of @Shashi's comment:

DEFINE QLOCAL ('RECV.Q')
DEFINE TOPIC('LOG.TO.DB') TOPICSTR('DBLOG')
DEFINE QALIAS('ALIAS.LOG.TO.DB') TARGET('LOG.TO.DB') TARGTYPE(TOPIC)
DEFINE QLOCAL('LOG.TO.DB.Q')
DEFINE SUB('SUB.FOR.RECV.Q') DEST('RECV.Q') TOPICOBJ('LOG.TO.DB')
DEFINE SUB('SUB.FOR.LOG.TO.DABASE') DEST('LOG.TO.DB.Q') TOPICOBJ('LOG.TO.DB')
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!