On Thu, May 28, 2009 at 2:34 PM, Arin <[email protected]> wrote: > > Can anyone suggest me how I can get the constant text from properties file: > > <camel:setHeader > headerName="from"><camel:constant>[email protected]</camel:constant></camel:setHeader> > > I want to set the mail address from properties file and not want to hard > code here. Please suggest me. Hi
You cannot do this easily out of the box with a simple XML tag. Spring property placeholder is limited in Spring 2.x. http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html I have created a ticket to track a new feature in Camel that allows you to more easily use properties file and access it from the Spring XML DSL https://issues.apache.org/activemq/browse/CAMEL-1656 You can use Spring to define a bean it as the java.util.Properties holding the values. There should be some spring docu how to do this in Spring XML as a spring bean. Then you can define a POJO class and have a setter for the properties and add a method to return the value public class MyFoo { private Properties ... void setProperties(Properties .. ) public String getEmail() { return properties.get("email"); } } <bean id="foo" class="com.mycompany.MyFoo"> <property name="properties" ref="spring bean id with properties"/> </bean> And then you can use the simple language to invoke this bean and set the header <simple>${bean:foo?method=getEmail}</simple> But you can also just use a Processor where you have access to the org.apache.camel.Exchange where you from Java code can set the header. You can maybe also use some of the scripting languages to invoke spring bean and access the properties http://camel.apache.org/languages.html > > > > -- > View this message in context: > http://www.nabble.com/How-to-set-from-id-and-subject-of-an-email-in-camel-context.com-tp23745547p23760832.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
