ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Message committed later left unread with BROWSE_NEXT option

Post new topic  Reply to topic
 Message committed later left unread with BROWSE_NEXT option « View previous topic :: View next topic » 
Author Message
nehamagarde
PostPosted: Wed Jan 02, 2019 4:11 am    Post subject: Message committed later left unread with BROWSE_NEXT option Reply with quote

Newbie

Joined: 02 Jan 2019
Posts: 3

Program Background:
In a reader program, we use MQGET API for browsing messages on queue with option BROWSE_NEXT. Multiple processes write messages on the queue from which the reader program browses.
At a later point of time based on some condition the messages will be deleted from queue.

Problem statement:
For a particular scenario, two processes write messages on the queue where reader program browses. One process puts message on queue but takes a little while to commit the XA transaction. Simultaneously a second process puts a message on the queue and commits (this will be the second message on the queue after the uncommitted one).
With BROWSE_NEXT option, the reader program skips the uncommitted message and browses the second message which was committed. Now when first process commits the message on queue it remains unread as the reader process reads with BROWSE_NEXT and the cursor is past the second message.


We tried to do a BROWSE_FIRST, but this solution doesn’t work as it may result in the same message being read twice.

Is there any way to know whether a particular message (maybe some get message option) was already browsed and shouldn’t be browsed again?
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Jan 02, 2019 5:25 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

Take a look at cooperative browsing here https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q026530_.htm
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Jan 03, 2019 1:24 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

You have described the classic problem that Browse with Mark was invented to solve.

Use the following options instead of your MQGMO_BROWSE_FIRST then MQGMO_BROWSE_NEXT:-

Code:
MQGMO_BROWSE_FIRST +
MQGMO_UNMARKED_BROWSE_MSG +
MQGMO_MARK_BROWSE_HANDLE +
MQGMO_WAIT


Or the handy constant defined in cmqc.h:-

Code:
MQGMO_BROWSE_HANDLE +
MQGMO_WAIT


If you have multiple readers, look into Cooperative Browse as well.

For more information check out this Slide Share presentation.

WebSphere MQ V7 API Enhancements (starting at page 49)

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
nehamagarde
PostPosted: Thu Jan 03, 2019 2:41 am    Post subject: Reply with quote

Newbie

Joined: 02 Jan 2019
Posts: 3

Thanks for the suggestion and it is now working as expected.

The program was also using option MQGMO_COMPLETE_MSG along with BROWSE_NEXT/BROWSE_FIRST.

With options MQGMO_UNMARKED_BROWSE_MSG and MQGMO_MARK_BROWSE_HANDLE it is suggested that we cannot use MQGMO_COMPLETE_MSG. Is there any impact on not using MQGMO_COMPLETE_MSG option while browsing?
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Jan 03, 2019 3:13 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Are you using segmented messages for this application?

If not, don't worry about MQGMO_COMPLETE_MSG. It is only necessary in order to ask the queue manager to re-assemble the segments of a message that was segmented.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
nehamagarde
PostPosted: Tue Jan 08, 2019 3:04 am    Post subject: Reply with quote

Newbie

Joined: 02 Jan 2019
Posts: 3

Thanks for information.

Above solution is working for us.

We are not using segmented message in our application.
Back to top
View user's profile Send private message
hughson
PostPosted: Tue Jan 08, 2019 2:46 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

That's great news!
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Message committed later left unread with BROWSE_NEXT option
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.