camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen">
Subject RE: Sending from a POJO to an endpoint
Date Tue, 21 Oct 2008 15:26:31 GMT

You can use the producer as a class variable, instead

Public class X

   @EndpointInject(name = "producer")
   Private ProducerTemplate producer;

And then you can use the same producer, but the first parameter is the uri

  producer.sendBody("bean:foo", payload);

And then you need to have the endpoint inject name as a spring bean id in the spring .xml
file. There is a special tag for this in camel = template as shown below.

<camelContext id="camel" xmlns="">
   <template id="producer"/>  

Med venlig hilsen
Claus Ibsen
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576

-----Original Message-----
From: selezovikj [] 
Sent: 21. oktober 2008 15:00
Subject: Sending from a POJO to an endpoint

I have the following code: 

while ((strLine = br.readLine()) != null)   {
		System.out.println("MESSAGE equals line in file");

		ProducerTemplate producer;
	} else {
		ProducerTemplate producer;


Basically I want if the line that I am reading from a file is matched with
messageName, I want the producer to send the "message" object to the
"filterCCBean". If I am in the else part, I want the object to be sent to
the "log4jBean". 
I guess this is not the right way to do this since Eclipse is complaining
the EndpointInject is not allowed for that location. 

Any help ?
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message