How to enable embedded kahadb ActiveMQ using bean config

I need to enable local saving of the built-in activeemq broker by enabling kahadb. How to configure kahadb in bean xml file.

<bean id="producerBroker" class="org.apache.activemq.broker.BrokerService" init-method="start" destroy-method="stop">

        <property name="brokerName" value = "producerBroker"/>
        <property name="persistent" value="true"/>
        <property name="transportConnectorURIs">
            <list>
                <value>tcp://localhost:7005</value>
            </list>
        </property>
        <property name="jmsBridgeConnectors">
            <list>
                <bean class="org.apache.activemq.network.jms.JmsQueueConnector">
                    <property name="outboundQueueConnectionFactory">
                        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                            <property name="brokerURL" value="http://localhost:8090" />
                        </bean>
                    </property>
                    <property name="outboundQueueBridges">
                        <list>
                            <bean class="org.apache.activemq.network.jms.OutboundQueueBridge">
                                <constructor-arg value="qvsample"/>
                            </bean>
                        </list>
                    </property>
                </bean>
            </list>
        </property>
    </bean>

      

EDIT

ActiveMQ default persistence db - kahoDb. this line <property name="persistent" value="true"/>

did it. I need to know how to change this db to another one. Also, I need a good link to spring xml file config for activemq?

+3


source to share


1 answer


You can create a bean from org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter

and inject it into your broker via a property persistenceAdapter

.

eg.



<bean id="persistenceAdapter" class="org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter">
    <property name="directory" value="D:\test"/>
</bean>

<bean id="producerBroker" class="org.apache.activemq.broker.BrokerService" init-method="start" destroy-method="stop">
    <property name="persistenceAdapter" ref="persistenceAdapter"/>
</bean>

      

You can use any other persistence adapter (like leveldb) as long as it implements org.apache.activemq.store.PersistenceAdapter

+2


source







All Articles