Examples of SubscribeKey


Examples of org.xmlBlaster.client.key.SubscribeKey

         ConnectQos connectQos = new ConnectQos(glob, name, passwd);
         con.connect(connectQos, this)// Login to xmlBlaster, register for updates

         // Subscribe for the volatile message
         SubscribeKey sk = new SubscribeKey(glob, "HelloWorldVolatile2");
         SubscribeQos sq = new SubscribeQos(glob);
         SubscribeReturnQos subRet = con.subscribe(sk, sq);

         // Publish a volatile message
         PublishKey pk = new PublishKey(glob, "HelloWorldVolatile2", "text/xml", "1.0");
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

    * to a new server instance.
    */
   private void initClient() {
      log.info("Entering initClient() and doing subscribes");
      try {  
         SubscribeKey sk = new SubscribeKey(glob, "Banking");
         SubscribeQos sq = new SubscribeQos(glob);
         sq.setWantInitialUpdate(false);
         con.subscribe(sk, sq);


         sk = new SubscribeKey(glob, "HelloWorld4");
         sq = new SubscribeQos(glob);
         sq.setWantInitialUpdate(false);
         con.subscribe(sk, sq, new I_Callback() {
            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               if (updateKey.getOid().equals("HelloWorld4"))
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

      // TODO: As soon we have implemented it here we need to remove
      //       data.setDuplicateUpdates(false); in NodeInfo.java

      //subscribeQos2.setMultiSubscribe(false);

      return con.subscribe(new SubscribeKey(this.glob, xmlKey), subscribeQos2);
   }
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

            log.warning("constructor: since 'mom.subscribeKey' is defined, 'mom.topicName' will be ignored");
      }
      else if (!momAdministered) {
         if (topicName == null)
            throw new XmlBlasterException(this.global, ErrorCode.USER_CONFIGURATION, ME, "at least one of the properties 'mom.topicName' or 'mom.subscribeKey' must be defined");
         subscribeKey = (new SubscribeKey(this.global, topicName)).toXml();
      }
      this.subscribeQos = this.global.get("mom.subscribeQos", (String)null, null, this.pluginConfig);
     
      if (momAdministered) {
         if (subscribeKey != null)
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

         Set listeners = (Set)oidListenerMap.get(msgOid);
         if (listeners != null && listeners.contains(callback))
            return//has subscribed already
      }

      SubscribeKey sk = new SubscribeKey(glob, msgOid);
      SubscribeQos sq = new SubscribeQos(glob);
      //String ret = xmlBlasterImpl.subscribe(sessionId, sk.toXml(), sq.toXml());
      SubscribeReturnQos subscribeReturnQos = xmlBlasterCon.subscribe(sk.toXml(), sq.toXml());

      // Remember subscriptions of this I_Notify instance ...
      synchronized (subscriptionsByNotifierMap) {
         Set subscriptions = (Set)subscriptionsByNotifierMap.get(callback);
         if (subscriptions == null) {
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

            log.info("First subscribe connect QoS = " + qosSub.toXml());
            crqSub = conSub.connect(qosSub, this.updateInterceptorSub); // Login to xmlBlaster
            log.info("Connect as subscriber '" + crqSub.getSessionName() + "' success");
         }

         SubscribeKey sk = new SubscribeKey(globSub, oid);
         SubscribeQos sq = new SubscribeQos(globSub);
         sq.setWantInitialUpdate(false);
         sq.setWantLocal(true);
         sq.setWantContent(true);
        
         HistoryQos historyQos = new HistoryQos(globSub);
         historyQos.setNumEntries(1);
         sq.setHistoryQos(historyQos);

         /*SubscribeReturnQos srq = */conSub.subscribe(sk.toXml(), sq.toXml());
         log.info("Subscription to '" + oid + "' done");

         log.info("============ STEP 2: Start publisher");
         Global globPub = glob.getClone(null);
         conPub = globPub.getXmlBlasterAccess();
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

         int numCreate = 1000000;
         MsgQueueSubscribeEntry entryArr[] = new MsgQueueSubscribeEntry[numCreate];
         log.info("Hit a key for new MsgQueueSubscribeEntry RAM size test ...");
         try { System.in.read(); } catch(java.io.IOException e) {}
         for(int i=0; i<numCreate; i++) {
            SubscribeKey sk = new SubscribeKey(glob, "XX");
            SubscribeQos sq = new SubscribeQos(glob);
            entryArr[i] = new MsgQueueSubscribeEntry(glob, storageId, sk.getData(), sq.getData());
            if (i > 0 && (i % step) == 0) {
               int loadSize = sk.toXml().length() + sq.toXml().length();
               log.info("Overall created #" + i + ": Created " + step + " new MsgQueueSubscribeEntry instances, key+qos size=" + loadSize + ", hit a key to create more ...");
               try { System.in.read(); } catch(java.io.IOException e) {}
            }
            if (log.isLoggable(Level.FINE)) log.fine("Dump meat: " + entryArr[i].toXml());
         }
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

                  fail(assertInUpdate); // This is routed to server, not to junit
                  return "";
               }
            });

         SubscribeKey sk = new SubscribeKey(glob1, oid);
         SubscribeQos sq = new SubscribeQos(glob1);
         con1.subscribe(sk.toXml(), sq.toXml());

         try { Thread.sleep(1000); } catch( InterruptedException i) {} // Wait some time
         assertTrue(assertInUpdate, assertInUpdate == null);

         Client.shutdownCb(con1, Client.Shutdown.LEAVE_SERVER);
         log.info("############ Con1 is down");

         assertInUpdate = null;
         con2 = glob2.getXmlBlasterAccess();
         qos = new ConnectQos(glob2)// force a new session
         con2.connect(qos, new I_Callback() {  // Login to xmlBlaster, register for updates
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info("****** Con2 update arrived" + updateKey.toXml() + updateQos.toXml());
                  assertInUpdate = glob2.getId() + "Reveiving asynchronous message '" + updateKey.getOid() + "' in second handler";
                  log.info(assertInUpdate);
                  return "";
               }
            });

         sk = new SubscribeKey(glob2, oid);
         sq = new SubscribeQos(glob2);
         con2.subscribe(sk.toXml(), sq.toXml());

         sk = new SubscribeKey(glob2, Constants.OID_DEAD_LETTER);
         sq = new SubscribeQos(glob2);
         con2.subscribe(sk.toXml(), sq.toXml(), new I_Callback() {
            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               deadMessageCounter++;
               log.info("****** Reveiving asynchronous message '" + updateKey.getOid() + "' in deadMessage handler, content=" + new String(content));
               assertEquals("No dead letter received", Constants.OID_DEAD_LETTER, updateKey.getOid());
               return "";
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

    */
   public void subscribe(String queryString, String queryType, AccessFilterQos aq, int numSub) {
      if (log.isLoggable(Level.FINE)) log.fine("Subscribing ...");
      try {
         for(int i=0; i<numSub; i++) {
            SubscribeKey key = new SubscribeKey(glob, queryString, queryType);
            SubscribeQos qos = new SubscribeQos(glob);
            qos.setMultiSubscribe(false);
            if (aq != null) {
               qos.addAccessFilter(aq);
            }
            SubscribeReturnQos ret = this.connection.subscribe(key.toXml(), qos.toXml());
            log.info("Subscribe #" + i + " state=" + ret.getState() + " subscriptionId=" + ret.getSubscriptionId());
            if (subscribeId == null) {
               subscribeId = ret.getSubscriptionId();
               assertEquals("", Constants.STATE_OK, ret.getState());
               continue;
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

    * Subscribe to message.
    */
   private void doSubscribe(I_XmlBlasterAccess con) {
      if (log.isLoggable(Level.FINE)) log.fine("Subscribing using EXACT oid syntax ...");
      try {
         SubscribeKey subscribeKey = new SubscribeKey(con.getGlobal(), this.oid);
         SubscribeQos subscribeQos = new SubscribeQos(con.getGlobal());
         String subscribeOid = con.subscribe(subscribeKey, subscribeQos).getSubscriptionId();
         log.info("Success: Subscribe on " + subscribeOid + " done");
         assertTrue("returned null subscribeOid", subscribeOid != null);
      } catch(XmlBlasterException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.