Examples of SubscribeKey


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

Examples of org.xmlBlaster.client.key.SubscribeKey

    */
   public void subscribe() {
      if (log.isLoggable(Level.FINE)) log.fine("Subscribing ...");
      try {
         {
            SubscribeKey key = new SubscribeKey(glob, publishOid);
            SubscribeQos qos = new SubscribeQos(glob);
            qos.setWantLocal(false);
            this.updateInterceptor1 = new MsgInterceptor(glob, log, null); // Collect received msgs
            SubscribeReturnQos ret = this.connection.subscribe(key.toXml(), qos.toXml(), this.updateInterceptor1);
            subscribeId1 = ret.getSubscriptionId();
         }
         {
            SubscribeKey key = new SubscribeKey(glob, publishOid);
            SubscribeQos qos = new SubscribeQos(glob);
            qos.setWantLocal(true);
            this.updateInterceptor2 = new MsgInterceptor(glob, log, null); // Collect received msgs
            SubscribeReturnQos ret = connection.subscribe(key.toXml(), qos.toXml(), this.updateInterceptor2);
            subscribeId2 = ret.getSubscriptionId();
         }
      } catch(XmlBlasterException e) {
         log.warning("XmlBlasterException: " + e.getMessage());
         fail("subscribe - XmlBlasterException: " + e.getMessage());
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

    */
   public void testSubscribeKey() {
      System.out.println("***QueryKeyFactoryTest: SubscribeKey ...");
     
      try {
         SubscribeKey subscribeKey = new SubscribeKey(glob, "oid");
         subscribeKey.setDomain("domain");
         subscribeKey.setQueryString("//query");

         System.out.println("SubscribeKey: " + subscribeKey.toXml());

         QueryKeyData key = factory.readObject(subscribeKey.toXml());

         assertEquals("", "oid", key.getOid());
         assertEquals("", "domain", key.getDomain());
         assertEquals("", "//query", key.getQueryString());
         assertEquals("", "XPATH", key.getQueryType()); // The last was setQueryString() so this is the used type
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

    */
   public void testExactSubscribeKey() {
      System.out.println("***QueryKeyFactoryTest: testExactSubscribeKey ...");
     
      try {
         SubscribeKey subscribeKey = new SubscribeKey(glob, "myOid", "EXACT");

         assertEquals("", "myOid", subscribeKey.getOid());
         System.out.println("SubscribeKey: " + subscribeKey.toXml());

         QueryKeyData key = factory.readObject(subscribeKey.toXml());

         assertEquals("", "myOid", key.getOid());
         assertEquals("", KeyData.CONTENTMIME_DEFAULT, key.getContentMime());
         assertEquals("", KeyData.CONTENTMIMEEXTENDED_DEFAULT, key.getContentMimeExtended());
         assertEquals("", (String)null, key.getDomain());
         assertEquals("", "EXACT", key.getQueryType());
         assertEquals("", (String)null, key.getQueryString());
      }
      catch (Throwable e) {
         System.out.println("Test failed: " + e.toString());
      }

      try {
         SubscribeKey subscribeKey = new SubscribeKey(glob, "//myTag", Constants.XPATH);
         subscribeKey.getData().setContentMime("AAA");
         subscribeKey.getData().setContentMimeExtended("BBB");
         subscribeKey.setDomain("CCC");

         assertEquals("", "myOid", subscribeKey.getOid());
         System.out.println("SubscribeKey: " + subscribeKey.toXml());

         QueryKeyData key = factory.readObject(subscribeKey.toXml());

         assertEquals("", (String)null, key.getOid());
         assertEquals("", "AAA", key.getContentMime());
         assertEquals("", "BBB", key.getContentMimeExtended());
         assertEquals("", "CCC", key.getDomain());
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

      } catch(XmlBlasterException e) { fail("Erase XmlBlasterException: " + e.getMessage()); }
   }

   private void subscribe(boolean wantNotify) {
      try {
         SubscribeKey sk = new SubscribeKey(this.glob, this.publishOid);
         SubscribeQos sq = new SubscribeQos(this.glob);
         sq.setWantNotify(wantNotify);
         this.senderConnection.subscribe(sk, sq);
      } catch(XmlBlasterException e) { fail("Subscribe XmlBlasterException: " + e.getMessage()); }
   }
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

         this.connGlobal = this.global.getClone(null);
         this.updateInterceptor = new MsgInterceptor(this.connGlobal, log, null);
         this.connGlobal.getXmlBlasterAccess().connect(new ConnectQos(this.connGlobal), this.updateInterceptor);
         SubscribeQos subQos = new SubscribeQos(this.connGlobal);
         subQos.setWantInitialUpdate(false);
         this.connGlobal.getXmlBlasterAccess().subscribe(new SubscribeKey(this.connGlobal, this.oid), subQos);
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
         fail("aborting since exception ex: " + ex.getMessage());
      }
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

   /**
    * TEST: Subscribe to messages with XPATH.
    */
   private void doSubscribe(int num, boolean isExact, boolean isPersistent) {
      try {
         SubscribeKey key = null;
         if (isExactkey = new SubscribeKey(this.glob, "Message-1");
         else key = new SubscribeKey(this.glob, "//TestPersistentSession-AGENT", "XPATH");

         SubscribeQos qos = new SubscribeQos(this.glob); // "<qos><persistent>true</persistent></qos>";
         qos.setPersistent(isPersistent);
         qos.setWantInitialUpdate(this.initialUpdates);
         qos.setWantNotify(false); // to avoig getting erased messages
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

         // Expecting actionType = "cpuinfo" or "meminfo" but it could be
         // any valid key oid.
         log.info("Got request for " + actionType + ", sessionId=" + sessionId + " ...");

         SubscribeKey xmlKey = new SubscribeKey(null, actionType);
         SubscribeQos xmlQos = new SubscribeQos(null);

         String ret = corbaConnection.subscribe(xmlKey.toXml(), xmlQos.toXml()).getSubscriptionId();
         log.info("Subscribed to " + actionType + "=" + ret);

         // NOTE: The callback messages (update()) are handled by our
         // BlasterHttpProxyServlet framework and pushed to the browser.
         // Typically a browser (or applet) can subscribe itself directly at BlasterHttpProxyServlet
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

      }
   }

   private void subscribe(String oid) {
      try {
         SubscribeKey sk = new SubscribeKey(glob, oid);
         SubscribeQos sq = new SubscribeQos(glob);
         SubscribeReturnQos srq = con.subscribe(sk.toXml(), sq.toXml());
         log.info("SUCCESS subscribe to '" + oid + "' returned state=" + srq.getState());
      } catch(XmlBlasterException e) {
         log.warning("XmlBlasterException: " + e.getMessage());
         fail("subscribe - XmlBlasterException: " + e.getMessage());
      }
View Full Code Here

Examples of org.xmlBlaster.client.key.SubscribeKey

      ME = "DirtyReadTest domain=" + domain + ": ";
      System.err.println("***DirtyReadTest: Publish a message to a cluster slave isDirtyReadTest=" + isDirtyReadTest + " ...");

      final String oid = isDirtyReadTest ? "PublishToBilbo-DirtyRead" : "PublishToBilbo-NODirtyRead";

      SubscribeKey sk;
      SubscribeQos sq;

      PublishKey pk;
      PublishQos pq;
      PublishReturnQos prq;
      MsgUnit msgUnit;

      try {
         System.err.println(ME+"->Connect to frodo ...");
         frodoCon = serverHelper.connect(serverHelper.getFrodoGlob(), new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  assertInUpdate = serverHelper.getFrodoGlob().getId() + ": Receive unexpected message '" + updateKey.getOid() + "'";
                  return "";
               }
            });
         try { Thread.sleep(1000); } catch( InterruptedException i) {} // Wait some time
         assertTrue(assertInUpdate, assertInUpdate == null);


         System.err.println(ME+"->Subscribe '" + oid + "' from frodo ...");
         sk = new SubscribeKey(glob, oid);
         sk.setDomain(domain);
         sq = new SubscribeQos(glob);
         frodoCon.subscribe(sk.toXml(), sq.toXml(), new I_Callback() {
            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               log.info("Reveiving asynchronous message '" + updateKey.getOid() + "' in " + oid + " handler");
               updateCounterFrodo++;
               assertInUpdate = null;
               return "";
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.