1 Reply Latest reply on Nov 14, 2007 5:45 PM by chirino_hchirino

    policyEntry element

    emjohnson

      When using a policyEntry element to configure a queue or a topic how do I determine when it is appropriate to use an attribute or a child element to specify the configuration?

      For example the policyEntry element has a pendingQueuePolicy attribute and can take a child pendingQueuePolicy element. Which is the one to use for configuring a queue to use VM cursors? Why?

        • 1. Re: policyEntry element
          chirino_hchirino

          Most configuration options can be configured either as an element or an attribute.  For simple values like strings, booleans, and numbers, configuring the value using the attribute is more compact than using the element notation.  For example:

          <broker brokerName="localhost">
          </broker>
          

           

          is equivalent to:

           

          <broker>
           <brokerName>localhost</brokerName>
          </broker>
          

           

          But you never see us use the second form since the first is so much more compact.  In other cases where the configured value is a complex object and not a simple value, the complex object can be specified using a bean reference or it can be defined inline using the element notation.  It usually easier to configure the object inline using the element notation versus using a object reference, so this is what we usually do.  For example:

           

          <policyEntry topic="FOO.>">   
             <pendingQueuePolicy>
               <fileQueueCursor></fileQueueCursor>
             </pendingQueuePolicy>
          </policyEntry>
          

          Would configure the pendingQueuePolicy property with the inline element but the same can be done using:

           

          <policyEntry topic="FOO.>" pendingQueuePolicy="#policy-a">   
          </policyEntry>
          

           

          and then outside the broker element defining a:

               

          <fileQueueCursor id="policy-a" xmlns="http://activemq.org/config/1.0"/>
          

           

          or even a:

          <bean id="policy-a" class="org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy"/>
          

           

          But as you saw, the first approach is much more compact way of doing it.

           

          Regards,

          Hiram

           

          Edited by: chirino on Nov 14, 2007 5:45 PM