camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: Is it possible to inject a bean in a class which extends a org.apache.camel.builder.RouteBuilder ?
Date Thu, 17 Jul 2008 05:40:13 GMT
Hi

Have you tried using the spring annotations for this? Check the spring reference documentation
how to set it up, remember to add the spring context annotation or what the xml tag is named,
that enables annotation driven injection. 

Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: cmoulliard [mailto:cmoulliard@gmail.com] 
Sent: 16. juli 2008 17:11
To: camel-user@activemq.apache.org
Subject: Is it possible to inject a bean in a class which extends a org.apache.camel.builder.RouteBuilder
?


Hi,

I try to inject a bean in a class which extends a
org.apache.camel.builder.RouteBuilder without success. So my question is
simple, is it possible ?

e.g.

1) MyRouterBuilder class wher I want to inject a bean (= EndPoint bean)

MyRouterBuilder class {

	private EndPointName endpointName = null;

	@Override
	public void configure() {

        // endpoint that I would like to inject
        from(EndPoints.FileClientIn)
       .to("");
     }
      
     // Inject endpoints dependency through Spring into my RouteBuilder
class
     public void setEndpointName(EndPointName endpointName) {
          this.endpointName = endpointName;
     }
}
2) Camel context file where the endPoint bean is declared

<bean id="endpointName" class="com.myApplication.util.EndPointName">
<property name="FileClientIn"
value="file:///c:/temp/xxx/clientA/input/?delete=false&amp;lock=true&amp;consumer.delay=500&amp;consumer.initialDelay=10"
/>
<property name="FileClientOutput" value="file:///c:/temp/xxx/clientA/output"
/>
<property name="RejectedQueueClientIn"
value="activemq:queue:rejectedmessages.clientA.queue" />
<property name="AcceptedQueueClientIn"
value="activemq:queue:xxx.clientA.queue" />
</bean>

Regards,



Charles Moulliard



-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site : www.xpectis.com 
-- 
View this message in context: http://www.nabble.com/Is-it-possible-to-inject-a-bean-in-a-class-which-extends-a-org.apache.camel.builder.RouteBuilder---tp18489666s22882p18489666.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message