You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Vegi, Vamsi (MAN-Corporate-CON)" <Va...@Manheim.com> on 2013/05/22 06:22:41 UTC

BridgePropertyPlaceholderConfigurer, could not get the properties, I searched the user forum but could not get the answer

Hello
Can anyone provide some input:

I am trying to access the properties defined in camel.properties file, but I cannot access it,
See below for details


In my XML I have

<bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
                <property name="locations">
                                <list>
                                                <value>classpath:camel.properties</value>
                                </list>
                </property>
</bean>

<camelContext id="ovc-inbound-jms-camel-app" xmlns="http://camel.apache.org/schema/spring">
                <routeBuilder ref="companyMsgRouter" />
                <routeBuilder ref="repMsgRouter" />
                <routeBuilder ref="customerGrpMsgRouter" />
                <routeBuilder ref="relCustGrp2CompanyMsgRouter" />
</camelContext>
=====================================================
In my code, I have


public class CompanyMsgRouter  extends RouteBuilder{
// some variables here

@Override
                public void configure() throws Exception {
                                LOG.info("CompanyMsgRouter: configure called");
                // some routes here
                System.out.println("camel context ready: " + getContext().getProperty("sayHi") );  // =======> Does not work, I get a null value
                } // end configure

} // end class

RE: BridgePropertyPlaceholderConfigurer, could not get the properties, I searched the user forum but could not get the answer

Posted by "Vegi, Vamsi (MAN-Corporate-CON)" <Va...@Manheim.com>.
Wonderful, works just fine

	System.out.println("camel context ready: " + getContext().resolvePropertyPlaceholders("sayHi") );

-thanks


-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Wednesday, May 22, 2013 2:55 AM
To: users@camel.apache.org
Subject: Re: BridgePropertyPlaceholderConfigurer, could not get the properties, I searched the user forum but could not get the answer

CamelContext.getProperty is NOT for property placeholders.

You can use this method
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders(java.lang.String)



On Wed, May 22, 2013 at 6:22 AM, Vegi, Vamsi (MAN-Corporate-CON) <Va...@manheim.com> wrote:
> Hello
> Can anyone provide some input:
>
> I am trying to access the properties defined in camel.properties file, 
> but I cannot access it, See below for details
>
>
> In my XML I have
>
> <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>                 <property name="locations">
>                                 <list>
>                                                 <value>classpath:camel.properties</value>
>                                 </list>
>                 </property>
> </bean>
>
> <camelContext id="ovc-inbound-jms-camel-app" xmlns="http://camel.apache.org/schema/spring">
>                 <routeBuilder ref="companyMsgRouter" />
>                 <routeBuilder ref="repMsgRouter" />
>                 <routeBuilder ref="customerGrpMsgRouter" />
>                 <routeBuilder ref="relCustGrp2CompanyMsgRouter" /> 
> </camelContext> =====================================================
> In my code, I have
>
>
> public class CompanyMsgRouter  extends RouteBuilder{ // some variables 
> here
>
> @Override
>                 public void configure() throws Exception {
>                                 LOG.info("CompanyMsgRouter: configure called");
>                 // some routes here
>                 System.out.println("camel context ready: " + getContext().getProperty("sayHi") );  // =======> Does not work, I get a null value
>                 } // end configure
>
> } // end class



--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen




Re: BridgePropertyPlaceholderConfigurer, could not get the properties, I searched the user forum but could not get the answer

Posted by Claus Ibsen <cl...@gmail.com>.
CamelContext.getProperty is NOT for property placeholders.

You can use this method
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders(java.lang.String)



On Wed, May 22, 2013 at 6:22 AM, Vegi, Vamsi (MAN-Corporate-CON)
<Va...@manheim.com> wrote:
> Hello
> Can anyone provide some input:
>
> I am trying to access the properties defined in camel.properties file, but I cannot access it,
> See below for details
>
>
> In my XML I have
>
> <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
>                 <property name="locations">
>                                 <list>
>                                                 <value>classpath:camel.properties</value>
>                                 </list>
>                 </property>
> </bean>
>
> <camelContext id="ovc-inbound-jms-camel-app" xmlns="http://camel.apache.org/schema/spring">
>                 <routeBuilder ref="companyMsgRouter" />
>                 <routeBuilder ref="repMsgRouter" />
>                 <routeBuilder ref="customerGrpMsgRouter" />
>                 <routeBuilder ref="relCustGrp2CompanyMsgRouter" />
> </camelContext>
> =====================================================
> In my code, I have
>
>
> public class CompanyMsgRouter  extends RouteBuilder{
> // some variables here
>
> @Override
>                 public void configure() throws Exception {
>                                 LOG.info("CompanyMsgRouter: configure called");
>                 // some routes here
>                 System.out.println("camel context ready: " + getContext().getProperty("sayHi") );  // =======> Does not work, I get a null value
>                 } // end configure
>
> } // end class



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen