Package org.xmlBlaster.client.key

Examples of org.xmlBlaster.client.key.PublishKey


         SubscribeQos sq = new SubscribeQos(glob);
         sq.setWantInitialUpdate(false);
         SubscribeReturnQos sr1 = con.subscribe(sk, sq);
         log.info("Subscribed '" + sr1.getState() + "'");

         PublishKey pk = new PublishKey(glob, this.topicName, "text/plain", "1.0");
         PublishQos pq = new PublishQos(glob);
         MsgUnit msgUnit = new MsgUnit(pk, "Hi", pq);
         PublishReturnQos retQos = con.publish(msgUnit);
         log.info("Published message '" + retQos.getKeyOid() + "'");
View Full Code Here


            // publish now
            Global global = new Global(args);
            qos = new ConnectQos(global, "testPublisher/1", "secret");
            I_XmlBlasterAccess conn = global.getXmlBlasterAccess();
            conn.connect(qos, this);
            PublishKey pubKey = new PublishKey(global, topicName);
            PublishQos pubQos = new PublishQos(global);
            for (int i=0; i < 5; i++) {
               String content = "This is test " + i;
               conn.publish(new MsgUnit(pubKey, content.getBytes(), pubQos));
            }
View Full Code Here

            // publish now
            Global global = new Global(args);
            qos = new ConnectQos(global, "testPublisher/1", "secret");
            I_XmlBlasterAccess conn = global.getXmlBlasterAccess();
            conn.connect(qos, this);
            PublishKey pubKey = new PublishKey(global, topicName);
            PublishQos pubQos = new PublishQos(global);
            for (int i=0; i < 5; i++) {
               String content = "This is test " + i;
               conn.publish(new MsgUnit(pubKey, content.getBytes(), pubQos));
            }
View Full Code Here

         // without setting the domain the subscribe would just be handled by the slave connected to
         SubscribeQos sq = new SubscribeQos(glob);
         SubscribeReturnQos srq = bilboCon.subscribe(sk.toXml(), sq.toXml());

         System.err.println("->Publish to avalon ...");
         PublishKey avalon_pk = new PublishKey(glob, oid, "text/plain", "1.0", domain);
         PublishQos avalon_pq = new PublishQos(glob);
         MsgUnit avalon_msgUnit = new MsgUnit(avalon_pk, contentStr, avalon_pq);
         PublishReturnQos avalon_prq = avalonCon.publish(avalon_msgUnit);
         assertEquals("oid changed", oid, avalon_prq.getKeyOid());
View Full Code Here

                  try {
                     String tempTopicOid = updateQos.getClientProperty(Constants.JMS_REPLY_TO, ""); // __jms:JMSReplyTo
                     log.info(receiverName+": Got request, using topic '" + tempTopicOid + "' for response");

                     // Send reply back ...
                     PublishKey pk = new PublishKey(receiver.getGlobal(), tempTopicOid, "text/plain", "1.0");
                     PublishQos pq = new PublishQos(receiver.getGlobal());
                     MsgUnit msgUnit = new MsgUnit(pk, "On doubt no ultimate truth, my dear.", pq);
                     //try { Thread.sleep(8000); } catch (InterruptedException e) { e.printStackTrace(); }
                     PublishReturnQos retQos = receiver.publish(msgUnit);
                     log.info(receiverName+": Published reply message using temporary topic " + retQos.getKeyOid());
                  }
                  catch (XmlBlasterException e) {
                     log.severe(receiverName+": Sending reply to " + updateQos.getSender() + " failed: " + e.getMessage());
                  }
                  return "";
               }
            })// Login to xmlBlaster, default handler for updates

            log.info("Receiver connected to xmlBlaster " + conRetQos.getSessionName().getRelativeName());
         }

         // Send a message to 'receiver' and block for the reply
         PublishKey pk = new PublishKey(sender.getGlobal(), "requestForEnlightenment");
         PublishQos pq = new PublishQos(sender.getGlobal());
         pq.addDestination(new Destination(new SessionName(sender.getGlobal(), receiverName)));
         MsgUnit msgUnit = new MsgUnit(pk, "Tell me the truth!", pq);
         MsgUnit[] replies = sender.request(msgUnit, 3000, 1);
         assertEquals("Missing reply message.", 1, replies.length);
View Full Code Here

         assertTrue(assertInUpdateBilbo, assertInUpdateBilbo == null);
         assertInUpdateBilbo = null;

         int num = 5;
         for (int i=0; i<num; i++) {
            PublishKey pk = new PublishKey(glob, oid, "text/plain", "1.0");
            pk.setDomain("RUGBY_NEWS"); // heron is master: need for routing as heron is not directly connected to us
            PublishQos pq = new PublishQos(glob);
            SessionName sessionName = heronCon.getConnectReturnQos().getSessionName(); // destination client
            Destination destination = new Destination(sessionName);
            destination.forceQueuing(true);
            pq.addDestination(destination);
View Full Code Here

        
         int extraEntries = endEntries - initialEntries;
         MsgUnit[] msgs = new MsgUnit[extraEntries];
         for (int i=0; i < extraEntries; i++) {
            String content = "extraMsg" + i;
            msgs[i] = new MsgUnit(new PublishKey(this.glob, oid), content, new PublishQos(this.glob));
         }
         long delay = waitingDelay / 3 + 10L;
         PublisherThread pubThread = new PublisherThread(this.glob, delay, msgs);

         // query with a given GetQos ...        
View Full Code Here

    * Construct a message and publish it persistent.
    */
   private void doPublish(I_XmlBlasterAccess con) {
      if (log.isLoggable(Level.FINE)) log.fine("Publishing a message");
      try {
         PublishKey publishKey = new PublishKey(con.getGlobal(), this.oid);
         PublishQos publishQos = new PublishQos(con.getGlobal());
         publishQos.setPersistent(true);
         String content = "Hi";
         MsgUnit msgUnit = new MsgUnit(publishKey, content.getBytes(), publishQos);
         con.publish(msgUnit);
View Full Code Here

            SubscribeQos sq = new SubscribeQos(glob);
            SubscribeReturnQos srq = bilboCon.subscribe(sk.toXml(), sq.toXml());
         }

         System.err.println("->Publish to avalon ...");
         PublishKey avalon_pk = new PublishKey(glob, oid, "text/plain", "1.0", domain);
         PublishQos avalon_pq = new PublishQos(glob);
         MsgUnit avalon_msgUnit = new MsgUnit(avalon_pk, contentStr.getBytes(), avalon_pq);
         PublishReturnQos avalon_prq = avalonCon.publish(avalon_msgUnit);
         assertEquals("oid changed", oid, avalon_prq.getKeyOid());
View Full Code Here

    */
   public void doPublish(int counter, String oid, boolean doGc, long sleep) throws XmlBlasterException {
      String content = "" + counter;
      log.info("Publishing message " + content);

      PublishKey key = new PublishKey(this.glob);
      if (oid != null) key.setOid(oid);
      key.setClientTags("<airport/>");
      PublishQos qos = new PublishQos(glob);
      qos.setPersistent(true);
      qos.setVolatile(true);
      qos.addDestination(new Destination(new SessionName(this.glob, "joe")));
      MsgUnit msgUnit = new MsgUnit(key, content, qos);
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.key.PublishKey

Copyright © 2018 www.massapicom. 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.