You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ryan Moquin <fr...@gmail.com> on 2008/01/15 22:42:30 UTC

Injecting a DeliveryChannel in servicemix-bean

If I have a servicemix-bean component that has a bean which contains other
beans as properties, and want to inject the DeliveryChannel into one of
those beans that are properties, how would I do that?  Do I have to set the
DeliveryChannel directly?  It doesn't appear that the Resource annotation
works for pojos that don't implement MessageExchangeListener.  Basically
here is a small stripped down example of what I'm doing.  Basically, I have
an xbean.xml with beans deployed which reference pojos in an imported spring
xml.  I'm trying to use the @Resource annotation to inject a
DeliveryChannel, which works in the NotificationRetrievalBean in the below
example, but doesn't in the JbiRetriever.  There main difference is the one
that works implements the MessageExchangeListener works and the other
doesn't.  Is there something else I need to do?  Is it the bean:endpoint
that causes the injection to occur?

xbean.xml

<beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
xmlns:svc="urn://notification.service">
  <bean:endpoint service="svc:notification-bean" endpoint="notification"
bean="#NotificationRetrievalBean"/>
  <bean id="NotificationRetrievalBean" class="
service.notification.NotificationRetrievalBean">
    <property name="jbiRetriever" ref="JbiRetriever"/>
  </bean>

  <import resource="classpath:my-jbi-spring.xml"/>
</beans>

my-jbi-spring.xml

<beans xmlns:bean="http://servicemix.apache.org/bean/1.0" xmlns:sm="
http://servicemix.apache.org/config/1.0"
       xmlns:svc="urn://notification.service">
  <bean id="JbiRetriever" class="service.notification.JbiRetrieverBean">
    <property name="destinationNamespace" value="destination.namespace"/>
    <property name="destinationService" value="destination.service"/>
  </bean>
</beans>