activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: Connection Refused from ActiveMQConnectionFactory
Date Wed, 27 Feb 2013 22:48:43 GMT
I guess the service factory that creates the broker should register a vm
connection factory service in osgi once it has successfully started a
broker,
 that could then be used to depend on. I think that is a sensible
enhancement.

One thing that may help today is adding a dependency on the service factory
from activemq-osgi in your blueprint.
 <service ref="activeMQServiceFactory"
interface="org.osgi.service.cm.ManagedServiceFactory">

Once that is available, bound, you know at least that the broker has
started.


On 27 February 2013 12:16, Neduz <nabble@neduz.be> wrote:

> Hello,
>
> Since I upgraded from ActiveMQ 5.7.0 to 5.8.0 in Karaf 2.3.0, I had to
> change the configuration for the setup of the embedded broker and the
> ConnectionFactory service.
> Previously I created the broker and the ConnectionFactory from the same
> blueprint XML file, using the activemq xbean namespace.
> Now the broker is created in a spring XML file (which was installed in the
> KARAF_HOME/etc folder automatically).
>
> I use this blueprint xml to create a ConnectionFactory service:
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>
> 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">
>
>
>     <ext:property-placeholder />
>
>     <bean id="activemqConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory" >
>         <property name="brokerURL"
> value="tcp://localhost:61616?connectionTimeout=10000" />
>                 <property name="userName" value="****"/>
>                 <property name="password" value="****"/>
>     </bean>
>
>     <bean id="pooledConnectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory">
>         <property name="maxConnections" value="50" />
>         <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.resourcemanager" />
>     </bean>
>
>     <reference id="transactionManager"
> interface="javax.transaction.TransactionManager" />
>
>     <service ref="pooledConnectionFactory"
> interface="javax.jms.ConnectionFactory">
>         <service-properties>
>             <entry key="name" value="amqCF-pool"/>
>         </service-properties>
>     </service>
>
> </blueprint>
>
>
> The result is that even though the Spring xml file has a lower start level
> in Karaf, the connectionFactory service gets a "connection refused" when
> the
> first bundle(s) tries to use the ConnectionFactory Service. When I restart
> the failed bundles, they can connect and the system runs fine.
>
> So the startlevel("default" broker) < startlevel(connection-factory.xml)<
> startlevel(my bundles using the connection factory).
>
> I tried the old blueprint-broker xml, but the namespace handler seems to be
> lacking (can't find it in the Services tab on the karaf web console). I
> cannot see an activemq-blueprint feature anymore (it's not listed in
> http://activemq.apache.org/osgi-integration.html either).
>
> I tried the "depends-on" attribute; but it seems blueprint can't see the
> spring-id's in other bundles/xml files.
>
> I also tried to play with the brokerUrl option "connectionTimeout", but the
> Connection Refused keeps coming at startup.
>
> The only work around I can think of (but haven't tried yet) is to create a
> "dummy bundle" with a start level between the broker and the connection
> factory service and perform a thread.sleep in the startUp method, hoping
> that the broker's threads have enough time to start before the
> ActiveMQConnectionFactory is started.
>
> I could also try to use spring-beans/spring-dm xml format to create the
> connectionfactory bean and register the service, but as I was only using
> blueprint so far, I'd like to stick to one standard for the whole
> application.
>
> Does anyone have any suggestions how to get the ConnectionFactory service
> running after the broker started?
>
>
> Kind regards,
>
> Tom Mercelis
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Connection-Refused-from-ActiveMQConnectionFactory-tp4664195.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
http://redhat.com
http://blog.garytully.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message