Package org.xmlBlaster.util.qos

Examples of org.xmlBlaster.util.qos.TopicProperty


            pq.setForceUpdate(true);
            pq.setSubscribable(false);
            pq.setLifeTime(60000L);
           
            if (i == 0) {
               TopicProperty topicProperty = new TopicProperty(glob);
               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;
View Full Code Here


         PublishQos pq = new PublishQos(glob);
         pq.setLifeTime(msgLifeTime);
         pq.setForceDestroy(false);
         if (initializeTopic) {
            // Configure the topic to our needs
            TopicProperty topicProperty = new TopicProperty(glob);
            topicProperty.setDestroyDelay(topicDestroyDelay);
            topicProperty.setCreateDomEntry(false);
            pq.setTopicProperty(topicProperty);
         }
         MsgUnit msgUnit = new MsgUnit(pk, senderContent, pq);
         PublishReturnQos publishReturnQos = con.publish(msgUnit);
         assertEquals("Retunred oid is invalid", publishOid, publishReturnQos.getKeyOid());
View Full Code Here

         pk.setClientTags(xpathTag);
         PublishQos pq = new PublishQos(glob);
         pq.setLifeTime(msgLifeTime);
         pq.setForceDestroy(false);
         // Configure the topic to our needs
         TopicProperty topicProperty = new TopicProperty(glob);
         topicProperty.setDestroyDelay(topicDestroyDelay);
         topicProperty.setCreateDomEntry(true);
         pq.setTopicProperty(topicProperty);
         MsgUnit msgUnit = new MsgUnit(pk, senderContent, pq);
         PublishReturnQos publishReturnQos = con.publish(msgUnit);
         log.info("Sending of '" + senderContent + "' done, returned oid=" + publishReturnQos.getKeyOid() + " " + msgUnit.toXml());
         return publishReturnQos.getKeyOid();
View Full Code Here

         PublishQos pq = new PublishQos(glob);
         pq.setLifeTime(msgLifeTime);
         pq.setForceDestroy(false);
         if (initializeTopic) {
            // Configure the topic to our needs
            TopicProperty topicProperty = new TopicProperty(glob);
            topicProperty.setDestroyDelay(topicDestroyDelay);
            topicProperty.setCreateDomEntry(false);
            pq.setTopicProperty(topicProperty);
         }
         MsgUnit msgUnit = new MsgUnit(pk, senderContent, pq);
         PublishReturnQos publishReturnQos = con.publish(msgUnit);
         assertEquals("Retunred oid is invalid", publishOid, publishReturnQos.getKeyOid());
View Full Code Here

   public void testHistory() {
      log.info("Entering testHistory ...");
      numReceived = 0;

      String keyOid = "smallTopic";
      TopicProperty topicProperty = new TopicProperty(glob);
      long topicDestroyDelay = 6000L;
      topicProperty.setDestroyDelay(topicDestroyDelay);
      topicProperty.setCreateDomEntry(false);
      createTopic(keyOid, topicProperty);

      /*
      {  // topic transition from START -> [2] -> ALIVE (3 sec)
         long msgLifeTime = 3000L;
View Full Code Here

         throw new XmlBlasterException(this.global, ErrorCode.USER_CLIENTCODE, ME, "no oid configured for publishing");
      if (content == null)
         throw new XmlBlasterException(this.global, ErrorCode.USER_CLIENTCODE, ME, "no content passed");
     
      PublishQos pubQos = new PublishQos(this.global);
      TopicProperty topicProp = new TopicProperty(this.global);
      topicProp.setMsgDistributor("ConsumableQueue,1.0");
      if (this.consumable) pubQos.setTopicProperty(topicProp);
      MsgUnit msgUnit = new MsgUnit(new PublishKey(this.global, this.publishOid), content, pubQos);
      this.accessor.publish(msgUnit);
   }
View Full Code Here

               //Example for a typed property:
               //pq.getData().addClientProperty("ALONG", (new Long(12)));
            }

            if (i == 0) {
               TopicProperty topicProperty = new TopicProperty(glob);
               topicProperty.setDestroyDelay(destroyDelay);
               topicProperty.setCreateDomEntry(createDomEntry);
               topicProperty.setReadonly(readonly);
               if (historyMaxMsg >= 0L) {
                  HistoryQueueProperty prop = new HistoryQueueProperty(this.glob, null);
                  prop.setMaxEntries(historyMaxMsg);
                  topicProperty.setHistoryQueueProperty(prop);
               }
               if (consumableQueue)
                  topicProperty.setMsgDistributor("ConsumableQueue,1.0");
               pq.setTopicProperty(topicProperty);
               log.info("Added TopicProperty on first publish: " + topicProperty.toXml());
            }

            if (destination != null) {
               log.fine("Using destination: '" + destination + "'");
               Destination dest = new Destination(glob, new SessionName(glob, destination));
View Full Code Here

         // Publish a volatile message
         PublishKey pk = new PublishKey(glob, "HelloWorldVolatile2", "text/xml", "1.0");
         PublishQos pq = new PublishQos(glob);
         pq.setVolatile(true);
         // Configure the topic to our needs
         TopicProperty topicProperty = new TopicProperty(glob);
         topicProperty.setDestroyDelay(4000L);
         topicProperty.setCreateDomEntry(false);
         pq.setTopicProperty(topicProperty);
         MsgUnit msgUnit = new MsgUnit(pk, "Hi", pq);
         con.publish(msgUnit);

         // This should not be possible as the message was volatile
View Full Code Here

    * @return true if the change is accepted
    */
   private final boolean allowedToReconfigureTopicAndFixWrongLimits(MsgQosData msgQosData) {
      if (this.topicProperty == null)
         return true;
      TopicProperty topicProps = msgQosData.getTopicProperty();
      if (topicProps == null) {
         log.warning("The TopicProperty is null, not reconfiguring anything");
         return false;
      }
      MsgUnitStoreProperty msgUnitStoreProps = topicProps.getMsgUnitStoreProperty();
      if (msgUnitStoreProps == null) {
         log.warning("The msgUnitStoreProps are null, not reconfiguring anything");
         return false;
      }

      MsgUnitStoreProperty currentMsgUnitStoreProps = this.topicProperty.getMsgUnitStoreProperty();
      long currentMaxBytes = currentMsgUnitStoreProps.getMaxBytes();
      long currentMaxBytesCache = currentMsgUnitStoreProps.getMaxBytesCache();
      long currentMaxEntries = currentMsgUnitStoreProps.getMaxEntries();
      long currentMaxEntriesCache = currentMsgUnitStoreProps.getMaxEntriesCache();
      StringBuffer report = new StringBuffer(1024);
      // msgUnitStoreProps.getMaxBytesProp().isSet() checks if the value is explicitely set by a client
      if (msgUnitStoreProps.getMaxBytes() == 0 || !msgUnitStoreProps.getMaxBytesProp().isSet() && currentMaxBytes > msgUnitStoreProps.getMaxBytes()) {
         report.append("msgUnitStore: 'currentMaxBytes='" + currentMaxBytes + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxBytes() + "' will leave it to '" + currentMaxBytes + "'\n");
         msgUnitStoreProps.setMaxBytes(currentMaxBytes);
      }
      if (msgUnitStoreProps.getMaxBytesCache() == 0 || !msgUnitStoreProps.getMaxBytesCacheProp().isSet() && currentMaxBytesCache > msgUnitStoreProps.getMaxBytesCache()) {
         report.append("msgUnitStore: 'currentMaxBytesCache='" + currentMaxBytesCache + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxBytesCache() + "' will leave it to '" + currentMaxBytesCache + "'\n");
         msgUnitStoreProps.setMaxBytesCache(currentMaxBytesCache);
      }
      if (msgUnitStoreProps.getMaxEntries() == 0 || !msgUnitStoreProps.getMaxEntriesProp().isSet() && currentMaxEntries > msgUnitStoreProps.getMaxEntries()) {
         report.append("msgUnitStore: 'currentMaxEntries='" + currentMaxEntries + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxEntries() + "' will leave it to '" + currentMaxEntries + "'\n");
         msgUnitStoreProps.setMaxEntries(currentMaxEntries);
      }
      if (msgUnitStoreProps.getMaxEntriesCache() == 0 || !msgUnitStoreProps.getMaxEntriesCacheProp().isSet() && currentMaxEntriesCache > msgUnitStoreProps.getMaxEntriesCache()) {
         report.append("msgUnitStore: 'currentMaxEntriesCache='" + currentMaxEntriesCache + "' > than what publish proposed: '" + msgUnitStoreProps.getMaxEntriesCache() + "' will leave it to '" + currentMaxEntriesCache + "'\n");
         msgUnitStoreProps.setMaxEntriesCache(currentMaxEntriesCache);
      }
      log.info("new msgUnitStore Props: " + msgUnitStoreProps.toXml());

      HistoryQueueProperty historyProps = topicProps.getHistoryQueueProperty();
      if (historyProps != null) {
         HistoryQueueProperty currentHistoryProps = this.topicProperty.getHistoryQueueProperty();
         currentMaxBytes = currentHistoryProps.getMaxBytes();
         currentMaxBytesCache = currentHistoryProps.getMaxBytesCache();
         currentMaxEntries = currentHistoryProps.getMaxEntries();
View Full Code Here

         this.msgUnitCache.clear()// Who removes the MsgUnitWrapper entries from their Timer?!!!! TODO
      }

      this.state = UNREFERENCED;

      TopicProperty topicProperty = this.topicProperty;
      if (!onAdministrativeCreate) {
         if (topicProperty == null) {
            EraseQosServer eraseQos = new EraseQosServer(serverScope, "<qos/>");
            eraseQos.setForceDestroy(true);
            notifyList = toDead(this.creatorSessionName, null, eraseQos);
            return notifyList; // ALIVE -> UNREFERENCED
         }
      }

      if (fromPersistenceStore) {
         if (log.isLoggable(Level.FINE))
            log.fine(ME+": Delay to set destroyDelay for topics from persistent store until all clients and subcriptions are recovered"); // SessionPersistencePlugin.java
      }
      else if (topicProperty != null) {
         if (topicProperty.getDestroyDelay() > 0L) {
            if (this.timerKey == null) {
               this.timerKey = this.destroyTimer.addTimeoutListener(this, topicProperty.getDestroyDelay(), getUniqueKey());
            }
         }
         else if (topicProperty.getDestroyDelay() == 0L) {
            timeout();   // toDead()
            return null; // destroy immediately
         }
      // for destroyDelay < 0 we live forever or until an erase arrives
      }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.qos.TopicProperty

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.