Package org.xmlBlaster.client

Examples of org.xmlBlaster.client.I_XmlBlasterAccess.publish()


         sq.addAccessFilter(new AccessFilterQos(glob, "XPathFilter", "1.0", "/news[@type='fishing']"));
         SubscribeReturnQos subRet = con.subscribe(sk, sq);


         msgUnit = new MsgUnit(pk, "<news type='fishing'/>".getBytes(), pq);
         con.publish(msgUnit);


         try { Thread.currentThread().sleep(1000); }
         catch( InterruptedException i) {} // wait a second to receive update()
View Full Code Here


                        + receiver
                        + "] Hit a key 'p' to publish, 'u' to unSubscribe or 'q' to quit >");
            if (ch == 'q')
               break;
            if (ch == 'p') {
               con.publish(new MsgUnit("<key oid='EmailDemo'/>", "Hi"
                     .getBytes(), "<qos/>"));
            }
            if (ch == 'u') {
               con.unSubscribe("<key oid='EmailDemo'/>", "<qos/>");
               break;
View Full Code Here

         // Publish a volatile message
         PublishKey pk = new PublishKey(glob, "HelloWorldVolatile", "text/xml", "1.0");
         PublishQos pq = new PublishQos(glob);
         pq.setVolatile(true);
         MsgUnit msgUnit = new MsgUnit(pk, "Hi", pq);
         con.publish(msgUnit);

         // This should not be possible as the message was volatile
         try {
            GetKey gk = new GetKey(glob, "HelloWorldVolatile");
            GetQos gq = new GetQos(glob);
View Full Code Here

         while (true) {
            int ch = Global.waitOnKeyboardHit("Hit a key to publish a message (type 'q' to quit)>");
            if (ch == 'q')
               break;
            con.publish(new MsgUnit("<key oid='EmailDemo'/>", "Hi".getBytes(),
                  "<qos/>"));
            Thread.sleep(1000);
         }
         con.disconnect(null);
      } catch (Exception e) {
View Full Code Here

         int numSend = glob.getProperty().get("numSend", 10);

         for (int ii=0; ii<numSend; ii++) {
            startTime = System.currentTimeMillis();
            con.publish(msgUnit);
            while (true) {
               try { Thread.sleep(50); } catch( InterruptedException i) {}
               if (messageArrived) {
                  messageArrived = false;
                  break;
View Full Code Here

         byte[] content = contentString.getBytes();

         PublishKey xmlKey = new PublishKey(glob, "", "text/plain", null);

         MsgUnit msgUnit = new MsgUnit(xmlKey.toXml(), content, "<qos><forceUpdate /></qos>");
         client.publish(msgUnit);
         log.info("Published a message");

         client.disconnect(null);
      }
      catch (XmlBlasterException ex) {
View Full Code Here

            PublishKey pk = new PublishKey(con.getGlobal(), "AllProtocols", "text/xml", "1.0");
            pk.setClientTags("<org.xmlBlaster><demo/></org.xmlBlaster>");
            PublishQos pq = new PublishQos(con.getGlobal());
            MsgUnit msgUnit = new MsgUnit(pk, "Hi", pq);
            con.publish(msgUnit);


            GetKey gk = new GetKey(con.getGlobal(), "AllProtocols");
            GetQos gq = new GetQos(con.getGlobal());
            MsgUnit[] msgs = con.get(gk.toXml(), gq.toXml());
View Full Code Here

            SubscribeQos sq = new SubscribeQos(con.getGlobal());
            SubscribeReturnQos subRet = con.subscribe(sk.toXml(), sq.toXml());


            msgUnit = new MsgUnit(pk, "Ho".getBytes(), pq);
            PublishReturnQos prq = con.publish(msgUnit);

            log.info("Got status='" + prq.getState() + "' for published message '" + prq.getKeyOid());

            try { Thread.sleep(1000); }
            catch( InterruptedException ie) {} // wait a second to receive update()
View Full Code Here

            else
               fail("testCreation failed: " + e.getMessage());
         }

         try {
            xmlBlasterAccess.publish(null);
         }
         catch (XmlBlasterException e) {
            if (e.isUser())
               log.info("Exception is OK if not connected: " + e.getErrorCode());
            else
View Full Code Here

         for (int j=0; j < sweeps; j++) {
            for (int i=0; i < nmax; i++) {
               points[i] = newPoint(points[i], bound);
               String content = new String(points[i].x + ";" + points[i].y);
               con.publish(new MsgUnit(glob, "<key oid='" + oidPrefix + "." + (i+1) + "'><" + oidPrefix + "/></key>", content.getBytes(),
                                           "<qos/>"));
            }
            Thread.sleep(200L);
         }
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.