You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by bbray <br...@theradoc.com> on 2007/11/21 05:47:47 UTC

how can I configure persistence adapter in URI?

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.


Re: how can I configure persistence adapter in URI?

Posted by James Strachan <ja...@gmail.com>.
On 21/11/2007, bbray <br...@theradoc.com> wrote:
>
> The BrokerService is exactly what I was looking for.  I initially had trouble
> with it, but I realized looking at your example that I was mistakenly
> calling addConnector() before I called setPersistanceAdapter().  When I
> swapped them around it worked great!

FWIW I think that bug (calling addConnector() tended to auto-create
the persistence adapter) is fixed in 5.0

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: how can I configure persistence adapter in URI?

Posted by bbray <br...@theradoc.com>.
The BrokerService is exactly what I was looking for.  I initially had trouble
with it, but I realized looking at your example that I was mistakenly
calling addConnector() before I called setPersistanceAdapter().  When I
swapped them around it worked great!

Thanks,
Brian


rajdavies wrote:
> 
> 
> 
>>
>> 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/
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-can-I-configure-persistence-adapter-in-URI--tf4848029s2354.html#a13873157
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: how can I configure persistence adapter in URI?

Posted by Rob Davies <ra...@gmail.com>.

>
> 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/