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 » General Discussion » Browse a Queue in random-Help plz...

Post new topic  Reply to topic
 Browse a Queue in random-Help plz... « View previous topic :: View next topic » 
Author Message
nithindoe
PostPosted: Fri Jun 19, 2009 8:56 pm    Post subject: Browse a Queue in random-Help plz... Reply with quote

Newbie

Joined: 18 Jun 2009
Posts: 3

Hi i want to browse an MQ queue randomly. Suppose if I have 10 messages i want to access the 5th message without starting browsing from first element itself just like accessing arrays in C or Java. Is there any way to do this...
Plz help me out......
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Jun 20, 2009 12:41 am    Post subject: Re: Browse a Queue in random-Help plz... Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

nithindoe wrote:
Is there any way to do this...


Firstly - no there isn't. You'll have to browse from the first down.

Secondly - I don't know about Java, but in C if you write a single line of code that accesses the 5th element of an array, internally it starts from the first element and works forward. Obviously in both languages it's simply memory elements so it's really, really fast.

Thirdly - why do you want to do this? It's a very poor design, aside from the performance issues (both because WMQ browsing is inefficient and you'll need a lot of browse on a deep queue). You should be reading the first message on the queue (which might not physically be the first one) or a specific one (like a reply to a request you've issued).
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
nithindoe
PostPosted: Sat Jun 20, 2009 9:54 am    Post subject: Reply with quote

Newbie

Joined: 18 Jun 2009
Posts: 3

hi i have a large queue and i need to browse it and display the messages in a webpage. the number of messages displayed at a time will depend on the value selected by user. So if the user select 10 first 10 messages wwill be displayed. then if he clicks next i have to show the next 10 messages. For this i have to again browse from the first one. when the queue is long it results in some perfomance issues.
How can i correct it???
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sat Jun 20, 2009 10:02 am    Post subject: Reply with quote

Poobah

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

From your narrative, I'll assume the same end-user wants the next 10 messages. After your app displays the first 10 messages, retain the browse cursor, then do a browse next. You don't need to start at the beginning of the queue.

Please read the WMQ Application Programming Reference for MQGET and all the MQGMO options.
_________________
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
Vitor
PostPosted: Sat Jun 20, 2009 10:53 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

nithindoe wrote:
i need to browse it and display the messages in a webpage. the number of messages displayed at a time will depend on the value selected by user.


It's an odd requirment, and bad practice to use a queue like this. If you need to examine a queue like this, load the messages into a database.

If it's just an administrative thing, use one of the existing support pacs.

If you adopt the suggestion of my associate, be sure to watch thread issues and queue handles.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
nithindoe
PostPosted: Sat Jun 20, 2009 8:20 pm    Post subject: Reply with quote

Newbie

Joined: 18 Jun 2009
Posts: 3

ok i'll try it..
thanks 4 ur replies
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Sun Jun 21, 2009 4:29 pm    Post subject: Re: Browse a Queue in random-Help plz... Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

Vitor wrote:
Secondly - I don't know about Java, but in C if you write a single line of code that accesses the 5th element of an array, internally it starts from the first element and works forward. Obviously in both languages it's simply memory elements so it's really, really fast.


Accessing elements of arrays in high level languages is truely random, it doesn't need to start from the first element and work forward, so I don't really understand your statement.
_________________
Glenn
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Sun Jun 21, 2009 4:38 pm    Post subject: Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

nithindoe wrote:
hi i have a large queue and i need to browse it and display the messages in a webpage. the number of messages displayed at a time will depend on the value selected by user. So if the user select 10 first 10 messages wwill be displayed. then if he clicks next i have to show the next 10 messages. For this i have to again browse from the first one. when the queue is long it results in some perfomance issues.
How can i correct it???


The best solution is to browse the queue in FIFO order "on demand" and store the Message Ids in an array (assuming they are unique). eg. if they first need messages 51-60, browse 1-60 and store MsgIds for all of them, and only get the message data for 51-60. If they scroll back to display 41-50, get the message data using the stored Message Ids. If they scroll forward to 61-70, start browsing and storing Message Ids again "on demand". Basically you are progressively building a cache of Message Ids. This technique will be efficient for large queue depths and large messages. If there are <100 message on the queue at any time and they are <10K long each, it is probably easier to just browse the whole queue each time. Mind you, if any other process is destructively removing messages at the time, my "on demand" method won't work.
_________________
Glenn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Browse a Queue in random-Help plz...
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.