All Downloads are FREE. Search and download functionalities are using the official Maven repository.

OSGI-INF.blueprint.activemq-service.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">

    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" />

    <cm:property-placeholder persistent-id="org.apache.servicemix.activemq.service" update-strategy="reload">
        <cm:default-properties>
            <cm:property name="broker-name" value="amq-broker"/>
        </cm:default-properties>
    </cm:property-placeholder>

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
        <property name="userName" value="$[activemq.jms.user]" />
        <property name="password" value="$[activemq.jms.password]" />
    </bean>

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

    <!-- connection factory wrapper to support auto-enlisting of XA resource -->
    <bean id="jmsXaPoolConnectionFactory" class="org.apache.activemq.pool.JcaPooledConnectionFactory">
        <property name="maxConnections" value="8" />
        <property name="connectionFactory" ref="jmsXaConnectionFactory" />
        <property name="transactionManager" ref="osgiJtaTransactionManager" />
        <property name="name" value="activemq.${broker-name}" />
    </bean>

    <bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
        <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000"/>
        <property name="userName" value="$[activemq.jms.user]" />
        <property name="password" value="$[activemq.jms.password]" />
        <property name="redeliveryPolicy">
            <bean class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="0"/>
            </bean>
        </property>
    </bean>

    <!--
        ActiveMQ XA Resource Manager
    -->
    <bean id="resourceManager"
          class="org.apache.activemq.pool.ActiveMQResourceManager"
          init-method="recoverResource">
        <property name="transactionManager" ref="osgiJtaTransactionManager" />
        <property name="connectionFactory" ref="jmsXaPoolConnectionFactory" />
        <property name="resourceName" value="activemq.${broker-name}" />
    </bean>


    <reference id="osgiJtaTransactionManager"
               interface="javax.transaction.TransactionManager"
               availability="mandatory" />

    <!--
        Register the javax.jms.ConnectionFactory in the OSGi Service Registry
    -->
    <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="default-cf"/>
            <entry key="transacted" value="false" />
            <entry key="osgi.jndi.service.name" value="jms/default-cf" />
        </service-properties>
    </service>

    <!--
        Register the javax.jms.ConnectionFactory for the XA PooledConnectionFactory in the OSGi Service Registry
    -->
    <service ref="jmsXaPoolConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="default-cf-xa" />
            <entry key="transacted" value="true" />
            <entry key="osgi.jndi.service.name" value="jms/default-cf-xa" />
        </service-properties>
    </service>
</blueprint>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy