Hi Albert,
there's a few different ways to do this - my preferred way is create
the broker separately in the same VM - e.g.
BrokerFactoryBean factory = new BrokerFactoryBean(new
ClassPathResource("org/apache/activemq/broker/policy/cursor.xml"));
factory.afterPropertiesSet();
BrokerService broker = factory.getBroker();
broker.start();
....
but ensure the broker has well known name - e.g. fred, then connect
to it using the URI vm://fred.
If the ActiveMQConnectionFactory discovers a broker in the same jvm
with the name you look for, it won't create a new one. By default, a
broker's name is localhost
cheers,
Rob
On 29 Jan 2007, at 12:11, Albert Strasheim wrote:
Hey Rob
Thanks very much for this. I'd like to try this in our unit tests,
which
is the first place we've been running into these problems (testing a
slow consumer with "fake" data, which is produced very fast).
Is there a way to configure policies using the broker URL or in the
queue/topic name (after the ?) from code? For our unit tests, we're
currently using an embedded broker, so this would makes things
relatively simple. Alternatively, is there a way to make an embedded
broker parse XML configuration somehow?
Thanks again.
Cheers,
Albert
On Mon, 29 Jan 2007, Rob Davies wrote:
Hi Albert,
from the latest in SVN it's possible to configure the cursor used for
a topic subscriber - which by default is file based. If you use a VM
based cursor, as messages aren't removed from memory (to spool to
disk) - the producer should block. You can configure the cursor type
using destination policies: http://incubator.apache.org/activemq/
xbean-xml-reference-41.html#XBeanXMLReference4.1-policyEntryelement
An example is: