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 » WebSphere Message Broker (ACE) Support » Iterating through the global Cache

Post new topic  Reply to topic
 Iterating through the global Cache « View previous topic :: View next topic » 
Author Message
Prasi
PostPosted: Fri Nov 15, 2013 8:50 am    Post subject: Iterating through the global Cache Reply with quote

Apprentice

Joined: 03 Aug 2011
Posts: 42

Hi,

How do I iterate through a global cache in IIB9.
For a general java map, we do as follows:
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println("Key = " + entry.getKey() + ", Value = " +
entry.getValue());}

But for MbGlobalMap how to iterate through the map because when I use the entrySet, it gives me error like The method entrySet() is undefined for the type MbGlobalMap... Can someone help me on this?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat Nov 16, 2013 3:43 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Code:

 map.find(....)


Take a look at the sample flows that use it. A really good starting point
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Prasi
PostPosted: Sat Nov 16, 2013 2:19 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Aug 2011
Posts: 42

Hi,

Could you please suggest me a example. I could not find one in help contents. I can find how to use the global cache in java compute node, how to configure etc.. but could not find one such example. If you have one, can you pls paste the link here.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 17, 2013 1:30 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Code:

   String[] value = (String[]) map.get(iata);
   if (value == null) {
      map.put(key, serials);
      result[0] = "Ok[I]: key=("+ key + ")  Value=" + serials[0];
   } else {
      map.update(key, serials);
      result[0] = "Ok[U]: key=("+ key + ")  Value=" + serials[0];
   }


Not from a JCN but from Java code called from ESQL.
This in turn was directly cribbed from the sample code described in the IBM Redbooks/RedPapers on the subject.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sun Nov 17, 2013 7:11 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

smdavies99 wrote:
Code:

   String[] value = (String[]) map.get(iata);
   if (value == null) {
      map.put(key, serials);
      result[0] = "Ok[I]: key=("+ key + ")  Value=" + serials[0];
   } else {
      map.update(key, serials);
      result[0] = "Ok[U]: key=("+ key + ")  Value=" + serials[0];
   }


That adds a single value to the map for a specific key.

It does not allow anyone to iterate over all keys in a given map.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Nov 17, 2013 10:48 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

mqjeff wrote:


That adds a single value to the map for a specific key.

It does not allow anyone to iterate over all keys in a given map.


That is true. I was showing a possible use case for map.get.

However, I am actually coming round to the conclusion that with the V8 Broker the cache subset does not allow you to iterate over all the elements in a given map. I'm not sure about IB 9 though.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
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 » WebSphere Message Broker (ACE) Support » Iterating through the global Cache
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.