Package org.xmlBlaster.client.qos

Examples of org.xmlBlaster.client.qos.ConnectReturnQos


         dataHolder.setReturnValue(true);
         rawReturnVal = securityInterceptor.importMessage(dataHolder).getQos();
      }

      try {
         this.connectReturnQos = new ConnectReturnQos(glob, rawReturnVal);
         setCheckpointContext(this.connectReturnQos);
      }
      catch (XmlBlasterException e) {
         log.severe("Can't parse returned connect QoS value '" + rawReturnVal + "': " + e.getMessage());
         throw e;
View Full Code Here


         rawReturnVal = securityInterceptor.importMessage(dataHolder).getQos();
      }

      this.connectReturnQos = null;
      try {
         this.connectReturnQos = new ConnectReturnQos(glob, rawReturnVal);
         setCheckpointContext(this.connectReturnQos);
         if (this.connectEntry != null) {
            if (this.connectEntry.wantReturnObj()) {
               this.connectEntry.setReturnObj(this.connectReturnQos);
            }
View Full Code Here

               ret = this.access.connect(connectQos, cb).toXml();
            }
            else {
               ConnectQosData data = this.connectQosFactory.readObject(this.qos.toString());
               // nectQosData data = new ConnectQosServer(this.glob, this.qos.toString()).getData();
               ConnectReturnQos tmp = this.access.connect(new ConnectQos(this.glob, data), cb);
               if (tmp != null) ret = tmp.toXml("  ");
               else ret = "";
            }
            writeResponse(methodName, ret);
            this.isConnected = true;
            if (!implicitConnect) {
View Full Code Here

                  "See 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html' for more details.");
            }
         }

         else if (MethodName.CONNECT == msgQueueEntry.getMethodName()) {
            ConnectReturnQos connectReturnQos = new ConnectReturnQos(glob, ((MsgQueueConnectEntry)msgQueueEntry).getConnectQosData());
            if (!connectReturnQos.getSessionName().isPubSessionIdUser()) {
               throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME,
                  "Can't find an xmlBlaster server. Try to provide the server host/port as described in " +
                  "http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.configuration.html " +
                  "or provide a public session ID to support polling for xmlBlaster without an initial connection. " +
                  "See 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html' for more details.");
View Full Code Here

         // A testsuite helper to collect update messages
         this.updateInterceptorSub = new MsgInterceptor(globSub, log, null);

         conSub = globSub.getXmlBlasterAccess();
        
         ConnectReturnQos crqSub = null;
         {
            ConnectQos qosSub = new ConnectQos(globSub, sessionNameSub, passwd);

            CallbackAddress addr = new CallbackAddress(globSub);
            addr.setRetries(-1);
            String secretCbSessionId = "TrustMeSub";
            addr.setSecretCbSessionId(secretCbSessionId);
            qosSub.getSessionCbQueueProperty().setCallbackAddress(addr);

            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();
         ConnectQos qosPub = new ConnectQos(globPub, sessionNamePub, passwd);
         ConnectReturnQos crqPub = conPub.connect(qosPub, null)// Login to xmlBlaster, no updates
         log.info("Connect success as " + crqPub.getSessionName());

         log.info("============ STEP 3: Stop subscriber callback");
         try {
            Client.shutdownCb(conSub, Client.Shutdown.KEEP_LOGGED_IN);
            // conSub.getCbServer().shutdown();
         }
         catch (XmlBlasterException e) {
            fail("ShutdownCB: " + e.getMessage());
         }

         log.info("============ STEP 4: Publish messages");
         int numPub = 8;
         MsgUnit[] sentArr = new MsgUnit[numPub];
         PublishReturnQos[] sentQos = new PublishReturnQos[numPub];
         for(int i=0; i<numPub; i++) {
            PublishKey pk = new PublishKey(globPub, oid, "text/xml", "1.0");
            pk.setClientTags("<org.xmlBlaster><demo/></org.xmlBlaster>");
            PublishQos pq = new PublishQos(globPub);
            pq.setPriority(PriorityEnum.NORM_PRIORITY);
            pq.setPersistent(false);
            pq.setLifeTime(60000L);
            if (i == 0) {
               TopicProperty topicProperty = new TopicProperty(globPub);
               topicProperty.setDestroyDelay(60000L);
               topicProperty.setCreateDomEntry(true);
               topicProperty.setReadonly(false);
               topicProperty.getHistoryQueueProperty().setMaxEntries(numPub+5);
               pq.setTopicProperty(topicProperty);
               log.info("Added TopicProperty on first publish: " + topicProperty.toXml());
            }

            byte[] content = "Hello".getBytes();
            MsgUnit msgUnit = new MsgUnit(pk, content, pq);
            sentArr[i] = msgUnit;
            PublishReturnQos prq = conPub.publish(msgUnit);
            sentQos[i] = prq;
            log.info("Got status='" + prq.getState() + "' rcvTimestamp=" + prq.getRcvTimestamp().toString() +
                        " for published message '" + prq.getKeyOid() + "'");
         }

         log.info("============ STEP 5: Start subscriber callback with same public sessionId");
         Global globSub2 = glob.getClone(null);
         MsgInterceptor updateInterceptorSub2 = new MsgInterceptor(globSub2, log, null);
         updateInterceptorSub2.setLogPrefix("TrustMeSub2");

         conSub2 = globSub2.getXmlBlasterAccess(); // Create a new client
         String secretCbSessionId2 = "TrustMeSub2";
         {
            ConnectQos qosSub = new ConnectQos(globSub, sessionNameSub, passwd);
            CallbackAddress addr = new CallbackAddress(globSub);
            addr.setRetries(-1);
            addr.setSecretCbSessionId(secretCbSessionId2);
            qosSub.getSessionCbQueueProperty().setCallbackAddress(addr);
            qosSub.getSessionQos().setSessionName(crqSub.getSessionQos().getSessionName());

            log.info("Second subscribe connect QoS = " + qosSub.toXml());
            ConnectReturnQos crqSub2 = conSub2.connect(qosSub, updateInterceptorSub2); // Login to xmlBlaster
            log.info("Connect as subscriber '" + crqSub2.getSessionName() + "' success");
         }

         assertEquals("", 0, updateInterceptorSub.count()); // The first login session should not receive anything

         assertEquals("", numPub, updateInterceptorSub2.waitOnUpdate(4000L, oid, Constants.STATE_OK));
View Full Code Here

                         "</qos>\n";

            String retXml = authServer.connect(qos);

            // Parse the returned string, it contains the server IOR
            ConnectReturnQos returnQos = new ConnectReturnQos(glob, retXml);

            log.info("Login (Connect) done.");
            log.info("Used QoS=\n" + qos);
            log.info("Returned QoS=\n" + returnQos.toXml());

            // Get the CORBA handle of xmlBlaster ...
            String xmlBlasterIOR = returnQos.getServerRef().getAddress();
            xmlBlaster = ServerHelper.narrow(orb.string_to_object(xmlBlasterIOR));

         } catch(org.xmlBlaster.protocol.corba.serverIdl.XmlBlasterException e) {
            log.warning("XmlBlasterException: " + e.getMessage());
         }
View Full Code Here

         // If we have many subs on one con, we must raise the max size of the callback queue!
         CbQueueProperty cbProp =connectQos.getSessionCbQueueProperty();
         cbProp.setMaxEntries(numSubscribers+1000);
         cbProp.setMaxEntriesCache(numSubscribers+1000);
         this.updateInterceptor = new MsgInterceptor(this.glob, log, this); // Collect received msgs
         ConnectReturnQos connectReturnQos = oneConnection.connect(connectQos, this.updateInterceptor);
         log.info("Connected: " + connectReturnQos.toXml());
      }
      catch (Exception e) {
          log.severe("Login failed: " + e.toString());
          e.printStackTrace();
          assertTrue("Login failed: " + e.toString(), false);
View Full Code Here

                        cbProp.setMaxEntries(maxSubPerCon*1000);//This means we have a backlog of 1000 messages per subscriber as i normal when each con only have one subscriber!
                        //cbProp.setMaxBytes(4000);
                        //cbProp.setOnOverflow(Constants.ONOVERFLOW_BLOCK);
                        //connectQos.setSubjectQueueProperty(cbProp);
                        log.fine("Login qos: " +  connectQos.toXml());
                        ConnectReturnQos connectReturnQos = manyConnections[ci].connect(connectQos, this);
                        log.info("Connected maxSubPerCon=" + maxSubPerCon + " : " + connectReturnQos.toXml());
                     }
                     catch (Exception e) {
                        log.severe("Login failed: " + e.toString());
                        assertTrue("Login failed: " + e.toString(), false);
                     }
                    
                  } // end of if ()
                  sub.connection = manyConnections[ci];
               } else {
                  sub.connection = oneConnection;
               }
            }else {
               try {
                  Global gg = globalUtil.getClone(glob);
                  sub.connection = gg.getXmlBlasterAccess();
                  ConnectQos connectQos = new ConnectQos(gg, sub.loginName, passwd); // "<qos></qos>"; During login this is manipulated (callback address added)
                  ConnectReturnQos connectReturnQos = sub.connection.connect(connectQos, this);
                  log.info("Connected: " + connectReturnQos.toXml());
               }
               catch (Exception e) {
                  log.severe("Login failed: " + e.toString());
                  assertTrue("Login failed: " + e.toString(), false);
               }                                                       
View Full Code Here

         cbAddr.setDelay(5000L);
         cbAddr.setPingInterval(5000L);
         cbAddr.setRetries(-1);
         connectQos.addCallbackAddress(cbAddr);
         XmlBlasterAccess access = (XmlBlasterAccess)this.connGlobal.getXmlBlasterAccess();
         ConnectReturnQos retQos = access.connect(connectQos, this.updateInterceptor, withQueue);
         log.info("connect return qos: " + retQos.toXml());
        
         SubscribeQos subQos = new SubscribeQos(this.connGlobal);
         subQos.setWantInitialUpdate(false);
         subQos.setMultiSubscribe(false);
         this.connGlobal.getXmlBlasterAccess().subscribe(new SubscribeKey(this.connGlobal, this.oid), subQos);
View Full Code Here

         ConnectQos qos = new ConnectQos(glob, loginName, passwd);
         log.info("Trying login to '" + loginName + "'");
         String retXml = authServer.connect(qos.toXml());

         // Parse the returned XML string and retrieve the secret sessionId
         ConnectReturnQos conRetQos = new ConnectReturnQos(glob, retXml);
         sessionId = conRetQos.getSecretSessionId();

         String publishOid = "";
         StopWatch stop = new StopWatch();

         //----------- Construct a message and publish it ---------
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.qos.ConnectReturnQos

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.