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 » global caching

Post new topic  Reply to topic
 global caching « View previous topic :: View next topic » 
Author Message
marwan
PostPosted: Mon Mar 23, 2015 9:11 am    Post subject: global caching Reply with quote

Newbie

Joined: 23 Mar 2015
Posts: 5

hi all ,

i m a new here , and i want to ask if anyone has done the global catching in wmb ???

please share with me the knowledge .


Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 23, 2015 9:16 am    Post subject: Re: global caching Reply with quote

Grand High Poobah

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

marwan wrote:
i want to ask if anyone has done the global catching in wmb


Yes I have.

marwan wrote:
please share with me the knowledge


What "knowledge"?

- Does it work? Yes
- How do I set it up? As described in the InfoCenter
- How do I use it? As described in the InfoCenter

That's about as much knowledge as you need. Unless you have a specific question....?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
marwan
PostPosted: Mon Mar 23, 2015 1:01 pm    Post subject: thanks Reply with quote

Newbie

Joined: 23 Mar 2015
Posts: 5

can u please share the links , i need ( step by step explanation)

and thanks for replaying back
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Mar 23, 2015 1:09 pm    Post subject: Re: thanks Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

marwan wrote:
can u please share the links , i need ( step by step explanation)


have you considered looking in the Knowledge Center?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 23, 2015 1:09 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Look in your toolkit under the samples & Tutorials item in the Help Menu.
Then go look for the Coordinated Request - Reply Sample.
This should give you all you need.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
marwan
PostPosted: Mon Mar 23, 2015 7:56 pm    Post subject: Reply with quote

Newbie

Joined: 23 Mar 2015
Posts: 5

Code:
hi this is my code see

the idea simple to read xml file and store all information in global caching then store it in database , if u want to read the same xml file it will check if this file in the global caching or otherwise it will put it inside the database
Code:


first flow ESQL node



CREATE COMPUTE MODULE LoadGlobalCache_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyMessageHeaders();
      --CALL CopyEntireMessage();
            
      DECLARE blnResult BOOLEAN TRUE;
      DECLARE blnMapResult BOOLEAN;
      
      DECLARE refMap REFERENCE TO InputRoot.XMLNSC.*[1];
      MOVE refMap NEXTSIBLING;
      MOVE refMap FIRSTCHILD;
      
      WHILE(LASTMOVE(refMap)) DO
      
         SET blnMapResult = addMapToCache(refMap);
         
         IF blnMapResult = FALSE THEN
            SET blnResult = FALSE;
         END IF;
         
         MOVE refMap NEXTSIBLING REPEAT TYPE NAME;
         
      END WHILE;   
      
      SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration) = ' ';
      SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
      SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
      
      IF blnResult THEN   
         SET OutputRoot.XMLNSC.Output.Result = 'Cache has been refreshed successfully';
      ELSE
         SET OutputRoot.XMLNSC.Output.Result = 'Error encountered while refreshing cache';
      END IF;      
      
      RETURN TRUE;
   END;

   CREATE PROCEDURE CopyMessageHeaders() BEGIN
      DECLARE I INTEGER 1;
      DECLARE J INTEGER;
      SET J = CARDINALITY(InputRoot.*[]);
      WHILE I < J DO
         SET OutputRoot.*[I] = InputRoot.*[I];
         SET I = I + 1;
      END WHILE;
   END;

   CREATE PROCEDURE CopyEntireMessage() BEGIN
      SET OutputRoot = InputRoot;
   END;
END MODULE;

CREATE PROCEDURE getCacheValue(IN chrMapName CHARACTER, IN chrKey CHARACTER) RETURNS CHARACTER
BEGIN
   
   DECLARE chrResult CHARACTER;
   SET chrResult = getCacheValueFromWXS(chrMapName,chrKey);
   IF (TRIM(chrResult) IS NULL OR TRIM(chrResult) ='' ) THEN
      THROW USER EXCEPTION MESSAGE 2999 VALUES('Failed to retrieve cache') ;
   END IF;
   RETURN chrResult;   
END;

CREATE PROCEDURE getCacheValueFromWXS(IN chrMapName CHARACTER, IN chrKey CHARACTER)
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "Utilities.CacheUtil.getValue";

CREATE PROCEDURE addMapToCache(IN refMap REFERENCE)
RETURNS BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "Utilities.CacheUtil.addMap";



Second Java compute node

import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.MbException;
import com.ibm.broker.plugin.MbGlobalMap;
import com.ibm.broker.plugin.MbMessage;
import com.ibm.broker.plugin.MbMessageAssembly;
import com.ibm.broker.plugin.MbOutputTerminal;
import com.ibm.broker.plugin.MbUserException;
import com.ibm.jvm.dtfjview.Output;


public class Global_ff_JavaCompute extends MbJavaComputeNode {

   public void evaluate(MbMessageAssembly contact admin) throws MbException {
      
         MbMessage message = contact admin.getMessage();

         
         
         //stored in the global cache
         String got = message.getRootElement().getFirstElementByPath("/M/NAME/").getValueAsString();
         
         // save
         byte[] lot = message.getRootElement().getFirstElementByPath("/M/").toBitstream(
            null, null, null,
            0, 0, 0
         );

         // Put key and data into map
         MbGlobalMap.getGlobalMap().put(got, lot);
      

   }}

help please ???????????????
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 24, 2015 4:42 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

So did you look at all at the sample?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
marwan
PostPosted: Tue Mar 24, 2015 5:40 am    Post subject: Reply with quote

Newbie

Joined: 23 Mar 2015
Posts: 5

yes sir , but im dealing with database .

the example is shown a simple thing
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 24, 2015 7:04 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You have posted your code. Now you need to explain what the problem is.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 24, 2015 7:23 am    Post subject: Reply with quote

Grand High Poobah

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

marwan wrote:
yes sir , but im dealing with database .


Not in the code you posted.

Also:

marwan wrote:
the idea simple to read xml file and store all information in global caching then store it in database , if u want to read the same xml file it will check if this file in the global caching or otherwise it will put it inside the database


Not only does this not match the posted code, this is an odd thing to do. Usually one would get data stored in a database and store it in a cache, not cache the data and then put it. You need to be clearer about what you're trying to do.

marwan wrote:
i need ( step by step explanation)


Of what? You've posted code which shows at least a basic understanding of the IIB cache & how to use it, even if your design's a bit confusing.So what's the problem?
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » global caching
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.