Package org.xmlBlaster.client.qos

Examples of org.xmlBlaster.client.qos.ConnectQos


    * @throws XmlBlasterException
    */
   public void init(String publishOid, String subscribeOid, boolean consumable, int session) throws XmlBlasterException {
      if (log.isLoggable(Level.FINER)) log.finer("init");
      this.consumable = consumable;
      ConnectQos connectQos = new ConnectQos(this.global, name, "secret");
      if (session > 0) {
         SessionName sessionName = new SessionName(this.global, name + "/" + session);
         connectQos.setSessionName(sessionName);
      }
      this.accessor.connect(connectQos, this);
      this.publishOid = publishOid;
      this.subscribeOid = subscribeOid;
      if (this.subscribeOid != null) {
View Full Code Here


         } // end of if ()
         try {
            // Connect
            state = "CONNECTING";
            con = glob.getXmlBlasterAccess();
            ConnectQos qos = new ConnectQos(glob, "test", "dummy");

            retQos = con.connect(qos, TestThreadLeak.this); // Login to xmlBlaster
            log.info("Connected "+ this);
            state = "CONNECTED";
            Thread.sleep(timeout);
View Full Code Here

      bulkSize = glob.getProperty().get("bulkSize", bulkSize);

      try {
         con = glob.getXmlBlasterAccess();
         ConnectQos qos = new ConnectQos(glob);
         conRetQos = con.connect(qos, new I_Callback() {

            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               log.info("Receiving asynchronous message '" + updateKey.getOid() +
                               "' state=" + updateQos.getState() + " in default handler");
View Full Code Here

      this.updateInterceptor = new MsgInterceptor(this.global, log, null);
   }
     
   public void init(boolean wantsPtP, boolean shutdownCb, long cbMaxEntries, long cbMaxEntriesCache, long subjMaxEntries, long subjMaxEntriesCache) throws XmlBlasterException {
      this.updateInterceptor.clear();
      ConnectQos qos = new ConnectQos(this.global);
      qos.setSessionName(this.sessionName);
      qos.setPtpAllowed(wantsPtP);
      qos.getSessionCbQueueProperty().setMaxEntries(cbMaxEntries);
      qos.getSessionCbQueueProperty().setMaxEntriesCache(cbMaxEntriesCache);
        
      if (subjMaxEntries > 0L || subjMaxEntriesCache > 0L) {  
         if (subjMaxEntries > 0L) qos.getSubjectQueueProperty().setMaxEntries(subjMaxEntries);
         if (subjMaxEntriesCache > 0L) qos.getSubjectQueueProperty().setMaxEntriesCache(subjMaxEntriesCache);
      }
        
      CallbackAddress cbAddress = new CallbackAddress(this.global);
      cbAddress.setRetries(-1);
      cbAddress.setPingInterval(-1);
      cbAddress.setDelay(250L);
      qos.addCallbackAddress(cbAddress);
     
      Address clientAddress = qos.getAddress();
      clientAddress.setRetries(-1);
      clientAddress.setPingInterval(-1);
      clientAddress.setDelay(10000L);
     
      this.updateInterceptor.clear();
View Full Code Here

      bulkSize = glob.getProperty().get("bulkSize", bulkSize);
      long lCount = 0L;

      try {
         con = glob.getXmlBlasterAccess();
         ConnectQos qos = new ConnectQos(glob);
         conRetQos = con.connect(qos, new I_Callback() {

            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               log.info("Receiving asynchronous message '" + updateKey.getOid() +
                               "' state=" + updateQos.getState() + " in default handler");
View Full Code Here

      bulkSize = glob.getProperty().get("bulkSize", bulkSize);
      interactive = glob.getProperty().get("interactive", interactive);

      try {
         con = glob.getXmlBlasterAccess();
         ConnectQos qos = new ConnectQos(glob);
         conRetQos = con.connect(qos, new I_Callback() {

            public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
               log.info("Receiving asynchronous message '" + updateKey.getOid() +
                               "' state=" + updateQos.getState() + " in default handler");
View Full Code Here

         log.info("   -forceDestroy   " + forceDestroy);
         log.info("   -persistent     " + persistent);

         I_XmlBlasterAccess con = glob.getXmlBlasterAccess();
         log.info("============= CreatingConnectQos");
         ConnectQos qos = new ConnectQos(glob);
         log.info("ConnectQos is " + qos.toXml());
         ConnectReturnQos crq = con.connect(qos, null)// Login to xmlBlaster, register for updates
         log.info("Connect success as " + crq.toXml());

         if (interactive) {
            log.info("Hit a key to erase");
View Full Code Here

         I_XmlBlasterAccess con = glob.getXmlBlasterAccess();

         // ConnectQos checks -session.name and -passwd from command line
         log.info("============= CreatingConnectQos");
         ConnectQos qos = new ConnectQos(glob);
         if (connectQosClientPropertyMap != null) {
            Iterator it = connectQosClientPropertyMap.keySet().iterator();
            while (it.hasNext()) {
               String key = (String)it.next();
               qos.addClientProperty(key, connectQosClientPropertyMap.get(key).toString());
            }
         }
         log.info("ConnectQos is " + qos.toXml());
         ConnectReturnQos crq = con.connect(qos, null)// Login to xmlBlaster
         log.info("Connect success as " + crq.toXml());
        
         MsgUnit[] msgs = null;
         if (queryOid != null) {
View Full Code Here

                           //"-dispatch/connection/plugin/socket/localPort", "8888"
                         };
         glob.init(args);
         */

         ConnectQos connectQos = new ConnectQos(glob);

         ClientQueueProperty prop = new ClientQueueProperty(glob, null);
         prop.setMaxEntries(10000);    // Client side queue up to 10000 entries if not connected

         Address address = new Address(glob);
         address.setDelay(4000L);      // retry connecting every 4 sec
         address.setRetries(-1);       // -1 == forever
         address.setPingInterval(2000L)// ping every 2 sec

         // Example how to hardcode a XmlRpc server:
         //address.setType("XMLRPC");    // force XmlRpc protocol
         //address.setRawAddress("http://noty:9456/"); // Address to find the server

         // Example how to hardcode a SOCKET server:
         //address.setType("SOCKET");    // force SOCKET protocol
         //address.setRawAddress("socket://noty:9988"); // Address to find the server

         prop.setAddress(address);
         connectQos.addClientQueueProperty(prop);

         CallbackAddress cbAddress = new CallbackAddress(glob);
         cbAddress.setDelay(4000L);      // retry connecting every 4 sec
         cbAddress.setRetries(-1);       // -1 == forever
         cbAddress.setPingInterval(4000L); // ping every 4 seconds
         //cbAddress.setDispatcherActive(false);

         // Example how to hardcode a SOCKET server:
         //cbAddress.setType("SOCKET");    // force SOCKET protocol for callback

         connectQos.addCallbackAddress(cbAddress);

         // We want to be notified about connection states:
         con.registerConnectionListener(new I_ConnectionStateListener() {

               public void reachedAlive(ConnectionStateEnum oldState, I_XmlBlasterAccess connection) {
                  conRetQos = connection.getConnectReturnQos();
                  log.info("I_ConnectionStateListener: We were lucky, connected to " + glob.getId() + " as " + conRetQos.getSessionName());
                  // we can access the queue via connectionHandler and for example erase the entries ...
               }
               public void reachedPolling(ConnectionStateEnum oldState, I_XmlBlasterAccess connection) {
                  log.warning("I_ConnectionStateListener: No connection to " + glob.getId() + ", we are polling ...");
               }
               public void reachedDead(ConnectionStateEnum oldState, I_XmlBlasterAccess connection) {
                  log.warning("I_ConnectionStateListener: Connection to " + glob.getId() + " is DEAD -> Good bye");
                  System.exit(1);
               }
               public void reachedAliveSync(ConnectionStateEnum oldState, I_XmlBlasterAccess connection) {
               }

            });

         // We connect to xmlBlaster and register the callback handle:
         this.conRetQos = con.connect(connectQos, 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());
               if (updateKey.isInternal()) {
                  log.severe("Receiving unexpected asynchronous internal message '" + updateKey.getOid() +
                                "' in default handler");
                  return "";
               }
               if (updateQos.isErased()) {
                  log.info("Message '" + updateKey.getOid() + "' is erased");
                  return "";
               }
               if (updateKey.getOid().equals("Banking"))
                  log.info("Receiving asynchronous message '" + updateKey.getOid() +
                               "' state=" + updateQos.getState() + " in default handler");
               else
                  log.severe("Receiving unexpected asynchronous message '" + updateKey.getOid() +
                                   "' in default handler");
               return "";
            }

         })// Login to xmlBlaster, default handler for updates


         if (con.isAlive())
            log.info("Connected as " + connectQos.getUserId() + " to xmlBlaster: " + this.conRetQos.getSessionName());
         else
            log.info("Not connected to xmlBlaster, proceeding in fail save mode ...");


         SubscribeKey sk = new SubscribeKey(glob, "Banking");
View Full Code Here

         // Check if other name or password was given on command line:
         String name = glob.getProperty().get("session.name", "HelloWorldVolatile2");
         String passwd = glob.getProperty().get("passwd", "secret");

         ConnectQos connectQos = new ConnectQos(glob, name, passwd);
         con.connect(connectQos, this)// Login to xmlBlaster, register for updates

         // Subscribe for the volatile message
         SubscribeKey sk = new SubscribeKey(glob, "HelloWorldVolatile2");
         SubscribeQos sq = new SubscribeQos(glob);
View Full Code Here

TOP

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

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.