You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Niels <st...@gmail.com> on 2013/04/16 09:05:03 UTC

Can get reference to AMQ ConnectionFactory

Hey there,

I'm trying to get a reference to the pooled AMQ Connectionfactory that's
default configured in the activemq-broker.xml like this:

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

I defined my reference in the blueprint file like this:

    <reference id="pooledConnectionFactory"
interface="javax.jms.ConnectionFactory" />

    <service id="socketNotificationService"
interface="xx.xx.ContextStartupListener">
        <bean class="xx.xx.SocketNotificationService">
            <property name="connectionFactory" ref="pooledConnectionFactory"
/>
        </bean>
    </service>

This seems pretty clear and straight forward. But when I try to use the
connectionFactory in my SocketNotificationService the factory is always
empty!

Any ideas any one? 
All the bundle for ActiveMQ are activated as well.

Running on: Mac OS X 10.8.3 with explicit use of Java version "1.6.0_43".






--
View this message in context: http://servicemix.396122.n5.nabble.com/Can-get-reference-to-AMQ-ConnectionFactory-tp5716494.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can get reference to AMQ ConnectionFactory

Posted by Niels <st...@gmail.com>.
Gert,

thanks for the reply. In the mean while I've been thinkering with my local
environment.
And play around with my code a little bit further.
I wasn't able to trank down the real origin of the problem so I image I
should have been a local system issue. But it works now, the bundle was
exporting it's service btw so no bugs in ServiceMix.

Alvast bedankt!

Niels



--
View this message in context: http://servicemix.396122.n5.nabble.com/Can-get-reference-to-AMQ-ConnectionFactory-tp5716494p5716571.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Can get reference to AMQ ConnectionFactory

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,


Could you try running osgi:ls to verify if the activemq-broker.xml
bundle is actually exporting the services?  That way, we can figure
out if the problem is at the publishing end or in your own bundle that
is trying to access the service.

I gave things a quick try with a new 4.5.1 installation: started with
the quickstart example at
http://servicemix.apache.org/docs/4.4.x/quickstart/activemq.html and
replacing the ActiveMQ component with one called "amqref" defined like
this:

    <reference id="pooledConnectionFactory"
interface="javax.jms.ConnectionFactory" />

    <bean id="amqref"
class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="connectionFactory" ref="pooledConnectionFactory"/>
    </bean>

This worked fine for me, so perhaps something else specific in your
setup is causing things to fail.  Could you try moving the bean
definition out of the <service/> tag and checking if that bean gets
injected with a proxy to the ConnectionFactory as expected?


Regards,

Gert Vanthienen


On Tue, Apr 16, 2013 at 9:05 AM, Niels <st...@gmail.com> wrote:
> Hey there,
>
> I'm trying to get a reference to the pooled AMQ Connectionfactory that's
> default configured in the activemq-broker.xml like this:
>
>     <service ref="pooledConnectionFactory"
> interface="javax.jms.ConnectionFactory">
>         <service-properties>
>             <entry key="name" value="localhost"/>
>         </service-properties>
>     </service>
>
> I defined my reference in the blueprint file like this:
>
>     <reference id="pooledConnectionFactory"
> interface="javax.jms.ConnectionFactory" />
>
>     <service id="socketNotificationService"
> interface="xx.xx.ContextStartupListener">
>         <bean class="xx.xx.SocketNotificationService">
>             <property name="connectionFactory" ref="pooledConnectionFactory"
> />
>         </bean>
>     </service>
>
> This seems pretty clear and straight forward. But when I try to use the
> connectionFactory in my SocketNotificationService the factory is always
> empty!
>
> Any ideas any one?
> All the bundle for ActiveMQ are activated as well.
>
> Running on: Mac OS X 10.8.3 with explicit use of Java version "1.6.0_43".
>
>
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Can-get-reference-to-AMQ-ConnectionFactory-tp5716494.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.