如何使用bean配置启用ActiveMQ嵌入式kahadb

时间:2015-06-01 06:45:53

标签: java spring persistence activemq

我需要通过启用kahadb来启用activemq嵌入式代理的本地持久性。如何在bean xml文件中配置kahadb。

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

修改

ActiveMQ的默认持久性db是kahoDb。这一行<property name="persistent" value="true"/>就是这样做的。我需要知道如何将此db更改为另一个。此外,我需要一个很好的参考,为activemq配置spring xml文件?

1 个答案:

答案 0 :(得分:2)

您可以创建#define ISIPHONE [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone UIPopoverController *popover; - (IBAction)openImagePicker:(UIButton *)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.allowsEditing = YES; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; //UIImagePickerControllerSourceTypeCamera if (ISIPHONE) { [self presentViewController:picker animated:YES completion:NULL]; } else { if (!popover) { popover = [[UIPopoverController alloc] initWithContentViewController:picker]; } [popover presentPopoverFromRect:sender.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } } 的bean,并通过org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter属性将其注入您的代理。

E.g。

persistenceAdapter

只要它实现<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>

,您就可以使用任何其他持久性适配器(例如leveldb)