Package org.xmlBlaster.client.qos

Examples of org.xmlBlaster.client.qos.PublishQos


                      "   <systemInfo />" +
                      "</key>";
      */
      PublishKey key = new PublishKey(glob, oid, "text/plain", "systemInfo");
      key.setClientTags("<systemInfo />");
      PublishQos qos = new PublishQos(glob);
      MsgUnit msgUnit = new MsgUnit(key, content.getBytes(), qos);

      try {
         con.publish(msgUnit);
      } catch(XmlBlasterException e) {
View Full Code Here


         con.connect(qos, this)// Login to xmlBlaster, register for updates


         PublishKey pk = new PublishKey(glob, "HelloWorldMime", "text/xml");
         pk.setClientTags("<org.xmlBlaster><demo/></org.xmlBlaster>");
         PublishQos pq = new PublishQos(glob);
         MsgUnit msgUnit = new MsgUnit(pk, "<news type='sport'/>".getBytes(), pq);
         con.publish(msgUnit);


         GetKey gk = new GetKey(glob, "HelloWorldMime");
View Full Code Here

   private void publish(String oid, int priority) {
      PriorityEnum prio = PriorityEnum.toPriorityEnum(priority);
      try {
         msgSequenceNumber++;
         String content = "" + msgSequenceNumber;
         PublishQos pq = new PublishQos(glob);
         pq.setPriority(prio);
         PublishReturnQos rq = con.publish(new MsgUnit("<key oid='"+oid+"'/>", content.getBytes(), pq.toXml()));
         log.info("SUCCESS publish '" + oid + "' with prio=" + prio.toString() + " content=" + content + " returned state=" + rq.getState());
         assertEquals("Returned oid wrong", oid, rq.getKeyOid());
         assertEquals("Return not OK", Constants.STATE_OK, rq.getState());
      } catch(XmlBlasterException e) {
         log.warning("XmlBlasterException: " + e.getMessage());
View Full Code Here

    * <p />
    * You will receive the result set wrapped in XML with a asynchronous update().
    */
   public MsgUnit toMessage() throws XmlBlasterException
   {
      PublishQos qos = new PublishQos(glob, new Destination(new SessionName(Global.instance(), "__sys__jdbc")));
      PublishKey key = new PublishKey(glob, "", "text/xml", "SQL_QUERY");
      return new MsgUnit(key, toXml().getBytes(), qos);
   }
View Full Code Here

         MsgQosData msgQosData = null;
         if (this.qos != null) {
            msgQosData = engineGlob.getMsgQosFactory().readObject(this.qos);
         }
         else {
            PublishQos publishQos = new PublishQos(engineGlob);
            publishQos.setLifeTime(-1L);
            publishQos.setForceUpdate(true);
            // TODO: Configure history depth to 0 only on first publish
            TopicProperty topicProperty = new TopicProperty(engineGlob);
            HistoryQueueProperty historyQueueProperty = new HistoryQueueProperty(engineGlob, engineGlob.getId());
            historyQueueProperty.setMaxEntriesCache(2);
            historyQueueProperty.setMaxEntries(2);
            topicProperty.setHistoryQueueProperty(historyQueueProperty);
            publishQos.setTopicProperty(topicProperty);
            msgQosData = publishQos.getData();
         }
         if (summary != null && summary.length() > 0)
            msgQosData.addClientProperty(Constants.EVENTPLUGIN_PROP_SUMMARY, summary); // "_summary"
         if (description != null && description.length() > 0)
            msgQosData.addClientProperty(Constants.EVENTPLUGIN_PROP_DESCRIPTION, description);
View Full Code Here

      // only activate if already in asyc mode, i.e. if there is at least
      // one msgListener associated to this session
      boolean realDoActivate = (doActivate && (this.syncMode == MODE_ASYNC));
      if ( (doActivate && this.syncMode == MODE_ASYNC) || !doActivate) {
         String oid = "__cmd:" + this.sessionName + "/?dispatcherActive=" + doActivate;
         PublishQos qos = new PublishQos(this.global);
         PublishKey key = new PublishKey(this.global, oid);
         this.global.getXmlBlasterAccess().publish(new MsgUnit(key, (byte[])null, qos));
         this.connectionActivated = realDoActivate;
      }
   }
View Full Code Here

      }

      try {
         if (log.isLoggable(Level.FINE)) log.fine("Publishing " + entries.length + " volatile dead messages");
         String[] retArr = new String[entries.length];
         PublishQos pubQos = new PublishQos(glob);
         pubQos.setVolatile(true);
         for (int ii=0; ii<entries.length; ii++) {
            MsgQueueEntry entry = entries[ii];
            if (entry == null) {
               log.severe("Didn't expect null element in MsgQueueEntry[], ignoring it");
               continue;
View Full Code Here

         if (origMsgUnit.getQosData().getClientProperties().get(clientPropertyKey) != null) {  // Check for recursion of dead letters
            log.warning("Recursive message '" + clientPropertyKey + "' is error handled already (sent as dead letter), we ignore it.");
            return origMsgUnit.getKeyOid();
         }
         origMsgUnit.getQosData().addClientProperty(clientPropertyKey, true); // Mark the original to avoid looping if failed client is the dead message listener
         PublishQos pubQos = new PublishQos(glob);
         pubQos.setVolatile(true);
         origMsgUnit.getQosData().addClientProperty(clientPropertyKey, true); // Mark the original to avoid looping if failed client is the dead message listener
         PublishKey publishKey = new PublishKey(glob, Constants.OID_DEAD_LETTER);
         //publishKey.setClientTags("<oid>"+entry.getKeyOid()+"</oid>");
         // null: use the content from origMsgUnit:
         pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGKEY, origMsgUnit.getKey()); //"__key"
         pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGQOS, origMsgUnit.getQos()); //"__qos"
         pubQos.addClientProperty(Constants.CLIENTPROPERTY_OID, origMsgUnit.getKeyOid()); //"__oid"
         pubQos.addClientProperty(Constants.CLIENTPROPERTY_RCVTIMESTAMP, origMsgUnit.getQosData().getRcvTimestamp()); //"__rcvTimestamp"
         pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGREASON, text); //"__deadMessageReason"
         if (receiver != null)
            pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGRECEIVER, receiver.getAbsoluteName());
         MsgUnit msgUnit = new MsgUnit(origMsgUnit, publishKey.getData(), null, pubQos.getData());
         return publish(unsecureSessionInfo, msgUnit);
      }
      catch(Throwable e) {
         log.severe("PANIC: " + origMsgUnit.getKeyOid() + " dead letter is lost, no recovery possible - dumping to file not yet coded: " + e.toString() + "\n" + origMsgUnit.toXml());
         e.printStackTrace();
View Full Code Here

                           origMsgUnit.toXml() + ": " +
                           ((text != null) ? (": " + text) : "") );
              Thread.dumpStack();
              return origMsgUnit.getKey();
           }
           PublishQos pubQos = new PublishQos(glob);
           pubQos.setVolatile(true);
           PublishKey publishKey = new PublishKey(glob, Constants.OID_DEAD_LETTER);
           pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGKEY, origMsgUnit.getKey()); //"__key"
           String qos = origMsgUnit.getQos();
           if (qos != null && qos.indexOf("</sender>") == -1 && sender != null) {
             // If import has not yet added the sender:
             int end = qos.indexOf("</qos>");
             if (end != -1)
               qos = qos.substring(0, end) + "<sender>" + sender.getAbsoluteName() + "</sender>" + qos.substring(end);
           }
           pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGQOS, qos); //"__qos"
           pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGREASON, text); //"__deadMessageReason"
           if (sender != null)
              pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGSENDER, sender.getAbsoluteName());
           if (receiver != null)
              pubQos.addClientProperty(Constants.CLIENTPROPERTY_DEADMSGRECEIVER, receiver.getAbsoluteName());
           MsgUnit msgUnit = new MsgUnit(publishKey, origMsgUnit.getContent(), pubQos);
           return publish(unsecureSessionInfo, msgUnit);
        }
        catch(Throwable e) {
           log.severe("PANIC: " + origMsgUnit.getKey() + " dead letter is lost, no recovery possible - dumping to file not yet coded: " + e.toString() + "\n" + origMsgUnit.toXml());
View Full Code Here

      }
      if (xmlQos == null) {
         xmlQos = xmlQosGiven;
      }
      if (xmlQos == null) {
         PublishQos publishQos = new PublishQos(glob);
         xmlQos = publishQos.toXml()// default qos = "<qos></qos>"
      }

      feed(xmlKey, content, xmlQos);
   }
View Full Code Here

TOP

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

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.