activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Creswick <Timothy.Cresw...@vorboss.com>
Subject RE: activemq-broker and osgi service registry
Date Tue, 12 Nov 2013 12:42:59 GMT
> The default configuration file activemq.xml is placed in the /etc directory.
> So far so good. Now I want to register the "pooledConnectionFactory" bean to
> the OSGi service registry.

We solve this problem with a separate Blueprint in the OSGi environment. For convenience we
roll this up into a Maven bundle so that we can version control it. The Blueprint was essentially
sourced from ServiceMix and looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
           xmlns:amq="http://activemq.apache.org/schema/core"
           xmlns:blueprint="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xsi:schemaLocation="
                     http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                     http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">


    <!-- Allows us to use system properties as variables in this configuration file -->
    <ext:property-placeholder />

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="vm://broker.${karaf.name}?create=false&amp;waitForStart=10000"
/>
    </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="recoverableTxManager" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
        <property name="resourceName" value="activemq.${name}" />
    </bean>

    <reference id="recoverableTxManager" interface="org.apache.geronimo.transaction.manager.RecoverableTransactionManager"
availability="mandatory" />

    <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="localhost"/>
        </service-properties>
    </service>

</blueprint>
Mime
View raw message