如何在blueprint.xml中配置jms队列

时间:2016-03-06 16:50:48

标签: jms activemq jndi karaf blueprint-osgi

如何在blueprint.xml中配置jms队列(在karaf中使用activemq),它存在于karaf deploy文件夹中..

下面是我的代码,它显示了blueprint.xml中的jms连接的配置..

<bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://localhost:61616" />
    <property name="userName" value="karaf" />
    <property name="password" value="karaf" />
</bean>

<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
    <property name="maxConnections" value="8" />
    <property name="connectionFactory" ref="activemqConnectionFactory" />
</bean>

<bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
    <property name="transactionManager" ref="transactionManager" />
    <property name="connectionFactory" ref="activemqConnectionFactory" />
    <property name="resourceName" value="activemq.localhost" />
</bean>

<reference id="transactionManager" interface="javax.transaction.TransactionManager" />

<service ref="activemqConnectionFactory" interface="javax.jms.ConnectionFactory">
    <service-properties>
        <entry key="name" value="connectionFactory" />
        <entry key="osgi.jndi.service.name" value="jms/connectionFactory" />
    </service-properties>
</service>

1 个答案:

答案 0 :(得分:-1)

您不必像在J2EE中那样在OSGi中配置队列。您只需在普通Java中使用连接工厂或配置camel-jms组件。