Steve,

I believe you're looking for something similar to this:

                PolicyEntry policy = new PolicyEntry();
                policy.setProducerFlowControl(true);
                policy.setMemoryLimit(500000);
                policy.setDestination(topic);
                
                PolicyMap destinationPolicy = new PolicyMap();
                destinationPolicy.setDefaultEntry(policy);
                broker.setDestinationPolicy(destinationPolicy);
        
Give it a try. Hope this helps...
        
-Marcelo


On May 19, 2011, at 1:23 PM, Steve Angelovich wrote:

> Thanks for the reference but I don't know all the classes well enough to 
> navigate through the javadocs and find the right information.
> 
> I have something like;
> 
> BrokerService broker = new BrokerService();
> broker.setBrokerName(_host+"_"+_port);
> broker.setUseJmx(true);
> broker.setDataDirectory(new File(_logdir, 
> DATA_DIRECTORY).getAbsolutePath());
> broker.setPersistent(false);
> 
> //set some of the memory limits for the broker
> long maxHeapSize = Runtime.getRuntime().maxMemory();
> long brokerHeapSize = (long) (maxHeapSize * .5) ;
> 
> SystemUsage su = _broker.getSystemUsage() ;
> su.setSendFailIfNoSpaceAfterTimeout(30 * 1000) ;
> MemoryUsage mu = su.getMemoryUsage() ;
> mu.setLimit(brokerHeapSize) ;
> broker.setSystemUsage(su) ;
> 
> How do I get from the BrokerService to the right classes to be able to 
> specify
> the message cursor I want to be used?
> 
> PolicyMap destinationPolicy = _broker.getDestinationPolicy() ;
> --> This returns null and I'm not sure if this is even what I'm looking for?
> 
> 
> //destinationPolicy.setPendingQueuePolicy(new 
> FilePendingQueueMessageStoragePolicy()) ;
> //destinationPolicy.setPendingSubscriberPolicy(new 
> FilePendingSubscriberMessageStoragePolicy()) ;
> //broker.setDestinationPolicy(destinationPolicy) ;
> 
> 
> Thanks again for the help,
> Steve
> 
> 
> On 05/19/2011 01:40 PM, Marcelo Jabali wrote:
>> Hi Steve,
>> 
>> Take a look on org.apache.activemq.broker.region.policy.PolicyEntry 
>> (http://activemq.apache.org/maven/5.3.1/activemq-core/apidocs/org/apache/activemq/broker/region/policy/PolicyEntry.html)
>> 
>> Hope this helps,
>> 
>> -Marcelo
>> 
>> 
>> 
>> 
>> On May 19, 2011, at 12:17 PM, Steve Angelovich wrote:
>> 
>>> I have an embedded broker and I want to set specify which cursor to use
>>> and some of the attributes.
>>> 
>>> When using the activemq.xml file I'm specifying something like;
>>> 
>>> <destinationPolicy>
>>> <policyMap>
>>> <policyEntries>
>>> <policyEntry topic=">" producerFlowControl="true" memoryLimit="50mb">
>>> <pendingSubscriberPolicy>
>>> <fileCursor />
>>> </pendingSubscriberPolicy>
>>> </policyEntry>
>>> <policyEntry queue=">" producerFlowControl="true" memoryLimit="50mb">
>>> <pendingQueuePolicy>
>>> <fileQueueCursor/>
>>> </pendingQueuePolicy>
>>> </policyEntry>
>>> </policyEntries>
>>> </policyMap>
>>> </destinationPolicy>
>>> 
>>> 
>>> Can somebody point me to an example or the right place in the javadocs
>>> so that I can specify this information programmatically  when using an
>>> embedded broker.
>>> 
>>> Thanks,
>>> Steve
>>> 
>>> ----------------------------------------------------------------------
>>> This e-mail, including any attached files, may contain confidential and 
>>> privileged information for the sole use of the intended recipient.  Any 
>>> review, use, distribution, or disclosure by others is strictly prohibited.  
>>> If you are not the intended recipient (or authorized to receive information 
>>> for the intended recipient), please contact the sender by reply e-mail and 
>>> delete all copies of this message.
>> 
>> 

--
Marcelo Jabali
Sr. Solutions Consultant
FuseSource
M: 978 729 6239
O: 619 464 2595
Web: fusesource.com
Skype/Twitter: mjabali

Reply via email to