开发者

Websphere MQ Message Read

At the moment I have a C# service that is reading messages off the queue (Websphere MQ) and writing them in a database. Everytime I do a GET the message dissappears from queue. I would like an additional functionality though. I prefer to read a message off the queue and remove it in from the queue only after the write in the database was succesful. Please note I do all these in a开发者_开发技巧 multithreaded application. I know there is a way to browse the queue but this doesn't really provide the functionality I need.


I'm writing my firts WMQ application, and I know I'll run into this issue very soon, so I found your question.

I've found this http://www.mqseries.net/phpBB2/viewtopic.php?t=43043&sid=11ad2d587dbd19056836ccc3f8943e5f (specifing MQOO_BROWSE option while opening the queue) in other forum, I haven't tried it yet, but it think it worth a try...

[]'s


I have implemented similar functionality in C++. Hopefully this helps you or someone.

You can browse messages without removing them from the queue using options MQGMO_BROWSE_FIRST and MQGMO_BROWSE_NEXT. How do I browse a Websphere MQ message without removing it?

Store message identifiers in a list or in any other suitable data structure. Write messages to the database.

Then get messages from the queue normally without BROWSE option. ImqQueue::Get takes two parameters: options and ImqMessage. Set message identifier to ImqMessage-class before calling get. ImqMessage acts as a filter. You can select only those messages that have been written successfully to the database.

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.amqzan.doc%2Fuc10330_.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜