activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: how can I configure persistence adapter in URI?
Date Wed, 21 Nov 2007 06:19:12 GMT


>
> I want to make a very lightweight use of ActiveMQ.  No external  
> config files,
> no JMS, no JDBC, just kaha persistence and the embedded VM broker.
>
> I create it like this:
>
> ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory("vm://localhost?broker.useJmx=false");
>
> But this initializes derby, etc.  Is there a way to do this:
>
> <persistenceAdapter>
>    <kahaPersistenceAdapter dir="activemq-journal"
> maxDataFileLength="10000000"/>
> </persistenceAdapter>
>
> But in the URI (or though java or properties objects) so I don't  
> have to
> require spring and/or have an external xml configuration file?
>
>
> Thanks,
> Brian
> -- 
> View this message in context: http://www.nabble.com/how-can-I- 
> configure-persistence-adapter-in-URI--tf4848029s2354.html#a13870998
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Hi Brian,

actually the easiest way would be to use the ActiveMQ 5.0 snapshot -  
see http://people.apache.org/repo/m2-snapshot-repository/org/apache/ 
activemq/apache-activemq/
The default message provider in version 5 is the AMQ Message Store -  
which is based on Kaha - see:  http://activemq.apache.org/new- 
features-in-50.html

Alternatively - see how to create and configure an embedded broker -  
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a- 
connection.html

or simply configure the broker explicitly in your code:


import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.store.kahadaptor.KahaPersistenceAdapter;

....

String bindAddress="vm://localhost";
BrokerService broker = new BrokerService();
KahaPersistenceAdapter adaptor = new KahaPersistenceAdapter();
  broker.setUseJmx(false);
  broker.setPersistenceAdapter(adaptor);
  broker.addConnector(bindAddress);
broker.start();

Then connect like this:

ConnectionFactory fac = new ActiveMQConnectionFactory(bindAddress);


cheers,

Rob

http://open.iona.com/ -Enterprise Open Integration
http://rajdavies.blogspot.com/


Mime
View raw message