Package org.xmlBlaster.client

Examples of org.xmlBlaster.client.I_Callback


      Client pub = doConnect("publisher", null);
      doPublish(pub.con);
      doPublish(pub.con);

      log.info("STEP3: Start subscriber and subscribe and block in callback");
      Client sub1 = doConnect("subscribe/1", new I_Callback() {
         public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) throws XmlBlasterException {
            log.info("Receiving update of a message oid=" + updateKey.getOid() +
                           " priority=" + updateQos.getPriority() +
                           " state=" + updateQos.getState() +
                           " we going to sleep and don't return control to server");
View Full Code Here


                      "   //TestSubDispatch-AGENT" +
                      "</key>";
      String qos = "<qos></qos>";
      numReceived = 0;
      try {
         subscribeRetQos = senderConnection.subscribe(xmlKey, qos, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info("Receiving message with specialized update(" + updateKey.getOid() + ") ... " + updateQos.toXml());

                  if (updateQos.isErased()) {
                     return "";
View Full Code Here

      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

                  qos.addClientProperty(key, connectQosClientPropertyMap.get(
                        key).toString());
               }
            }
            //log.info("ConnectQos is " + qos.toXml());
            /* ConnectReturnQos crq = */con.connect(qos, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey,
                     byte[] content, UpdateQos updateQos)
                     throws XmlBlasterException {
                  try {
                     log.info("Received '" + updateKey.getOid() + "':"
View Full Code Here

         System.err.println("->Connect to avalon ...");
         avalonCon = serverHelper.connect(serverHelper.getAvalonGlob(), null);

         {
            System.err.println("->Connect to bilbo ...");
            bilboCon = serverHelper.connect(serverHelper.getBilboGlob(), new I_Callback() {  // Login to xmlBlaster, register for updates
                  public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                     if (updateQos.isErased()) {
                        log.info("Ignoring erase message");
                        return "";
                     }
                     updateCounterBilbo++;
                     log.info(
                              "Receiving update '" + updateKey.getOid() + "' " + updateCounterBilbo + " ...");
                     assertEquals("Wrong message updated", oid, updateKey.getOid());
                     return "";
                  }
               });

            System.err.println("->Subscribe from bilbo ...");
            SubscribeKey sk = new SubscribeKey(glob, oid);
            sk.setDomain(domain);
            SubscribeQos sq = new SubscribeQos(glob);
            bilboCon.subscribe(sk.toXml(), sq.toXml());
         }

         {
            System.err.println("->Connect to bilbo 2 ...");
            final Global bilboGlob2 = serverHelper.getBilboGlob().getClone(null);
            bilboCon2 = serverHelper.connect(bilboGlob2, new I_Callback() {  // Login to xmlBlaster, register for updates
                  public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                     if (updateQos.isErased()) {
                        log.info("Ignoring erase message");
                        return "";
                     }
View Full Code Here

         try { Thread.sleep(1000); } catch( InterruptedException i) {} // Wait some time

         for (int ii=0; ii<num; ii++) {
            System.err.println("->Connect to bilbo #" + ii + " ...");
            final Global bilboGlobii = serverHelper.getBilboGlob().getClone(null);
            bilboCons[ii] = serverHelper.connect(bilboGlobii, new I_Callback() {  // Login to xmlBlaster, register for updates
                  public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                     log.info(
                              "Receiving update '" + updateKey.getOid() + "' state=" + updateQos.getState() + ", " + updateCounterBilbo + " ...");
                     if (updateQos.isErased()) {
                        log.info("Ignoring erase message");
View Full Code Here

         // Subscribe to messages with XPATH using some helper classes
         log.info("Subscribing #1 for anonymous callback class using XPath syntax ...");
         SubscribeKey key = new SubscribeKey(glob, "//DispatchTest", "XPATH");
         SubscribeQos qos = new SubscribeQos(glob);
         blasterConnection.subscribe(key, qos, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info("Receiving message with specialized update() #1 ...");
                  numReceived1++;
                  System.out.println(updateKey.toXml());
                  System.out.println((new String(content)).toString());
                  System.out.println(updateQos.toXml());
                  return "";
               }
            });


         log.info("Subscribing #2 for anonymous callback class using XPath syntax ...");
         key = new SubscribeKey(glob, "A message id");
         blasterConnection.subscribe(key, qos, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info("Receiving message with specialized update() #2 ...");
                  numReceived2++;
                  System.out.println(updateKey.toXml());
                  System.out.println((new String(content)).toString());
View Full Code Here

         con = new XmlBlasterAccess(glob);

         ConnectQos qos = new ConnectQos(this.glob); /* Client side object */
         qos.setUserId(this.loginName);
         qos.getSessionQos().setSessionTimeout(0L);
         con.connect(qos, new I_Callback() {

            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               if (log.isLoggable(Level.FINEST)) log.finest("UpdateKey.toString()=" + updateKey.toString() +
                                          "UpdateQos.toString()=" + updateQos.toString());
               if (updateKey.isInternal()) {
View Full Code Here

      try {
         System.err.println("->Connect to avalon ...");
         avalonCon = serverHelper.connect(serverHelper.getAvalonGlob(), null);

         System.err.println("->Connect to bilbo ...");
         bilboCon = serverHelper.connect(serverHelper.getBilboGlob(), new I_Callback() {  // Login to xmlBlaster, register for updates
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  updateCounterBilbo++;
                  log.info(
                           "Receiving update '" + updateKey.getOid() + "' " + updateCounterBilbo + " ...");
                  assertEquals("Wrong message updated", oid, updateKey.getOid());
View Full Code Here

         // setup the receiver client which processes the request (usually another process) ...
            Global globReceiver = glob.getClone(null);
            receiver = globReceiver.getXmlBlasterAccess();

            ConnectQos qos = new ConnectQos(receiver.getGlobal(), receiverName, "secret");
            ConnectReturnQos conRetQos = receiver.connect(qos, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info(receiverName+": Receiving asynchronous message '" + updateKey.getOid() + "' in receiver default handler");
                  log.info(receiverName+": Received: " + updateKey.toXml() + "\n <content>" + new String(content) + "</content>" + updateQos.toXml());

                  if (updateKey.isInternal()) return "";
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.I_Callback

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.