activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ami.rozen" <>
Subject Loading embedded broker with an xml configuration
Date Wed, 17 Mar 2010 09:15:37 GMT

We are using activemq 5.1 and running a broker embedded in our java
application (a standard one).
Currently we are configuring the broker using java code.
The problems we have are:
1.We don't seem to be able to make the broker use the temp storage (the
configuration is below)
2.When using persistent = true storage files seems to always grow and are
never being deleted.
3. We can't start the embedded broker using an external xml configuration
file. We tried understanding how to do it from
using the BrokerFactory with a url in the format of
file:foo/bar/activemq.xml but we get the following error:
Caused by: Could not find factory class for resource:
	... 11 more

The java configuration of the broker is as follows:

URI serviceUrl = new URI( brokerUri + "?jms.prefetchPolicy.all=" +
jmsMaxMessages + "&wireFormat.maxInactivityDuration=0" + "?useJmx=true" );

broker = new BrokerService();
broker.setUseJmx( true );
broker.addConnector( serviceUrl );
broker.setPersistent( false );
ManagementContext managementContext = new ManagementContext();
managementContext.setConnectorPort( 1098 );
broker.setManagementContext( managementContext );

SystemUsage memoryManager = new SystemUsage();
MemoryUsage memoryUsage = new MemoryUsage();
memoryUsage.setLimit( 512000000 );
memoryManager.setMemoryUsage( memoryUsage );

TempUsage tempDiskUsage = new TempUsage();
tempDiskUsage.setLimit( 100000000);
memoryManager.setTempUsage( tempDiskUsage );

StoreUsage storeUsage = new StoreUsage();
storeUsage.setLimit( 999999999 );
storeUsage.setName( "foo" );
memoryManager.setStoreUsage( storeUsage );

broker.setSystemUsage( memoryManager );

broker.setTempDataStore( tempDataStore );
broker.setTmpDataDirectory( new File( dataDirectory ) );

    PersistenceAdapter adapter = broker.getPersistenceAdapter();
    adapter.setUsageManager( memoryManager );
    if( adapter instanceof AMQPersistenceAdapter )
    AMQPersistenceAdapter amqPersistenceAdapter = (AMQPersistenceAdapter)

    if( persistent )
        amqPersistenceAdapter.setPersistentIndex( true );
        amqPersistenceAdapter.setPersistentIndex( false );

We have tried to change the configuration in so many ways, none seems to
work ...

Thank you for your help
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message