using properties file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

using properties file

terminator_008
Hi, I am reading some values from a property file in the camel -config.
I want to be able to use ${dev2hub1odepatientservice.uri} in the Pipeline set header element. But it does not work.
Here is my camel-config file. Would appreciate any pointers.
       <bean id="test" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="location" value="classpath:camel-dev.properties" />

    </bean>
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <endpoint id="devOdePatientService" uri="${dev2hub1odepatientservice.uri}"></endpoint>
                 <route errorHandlerRef="myDeadLetterErrorHandler">
                         <from uri="activemq:topic:topic.PATIENT?clientId=camelClientPatient&amp;durableSubscriptionName=patientTopicSubscriber"/>
             <to uri="bean:soapMessageCreator"/>
        <multicast >
        <pipeline>
                                    <setHeader headerName="endpointURL">
                                          <constant>${dev2hub1odepatientservice.uri}</constant>
                                    </setHeader>
                                    <to ref="devOdePatientService"/>
                             </pipeline>
                     </multicast>
        </route>
        <route>
      <from uri="activemq:topic:topic.TEST1"/>
      <to uri="activemq:topic:topic.TEST"/>
    </route>
       
  </camelContext>
Reply | Threaded
Open this post in threaded view
|

Re: using properties file

tide08
It is known issue, you cannot use properties in camelContext tag but there are ways to achieve this. See below thread for more details -

http://old.nabble.com/reading-endpoints-from-a-properties-file-td25894947.html#a25895352

Thanks!

terminator_008 wrote
Hi, I am reading some values from a property file in the camel -config.
I want to be able to use ${dev2hub1odepatientservice.uri} in the Pipeline set header element. But it does not work.
Here is my camel-config file. Would appreciate any pointers.
       <bean id="test" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="location" value="classpath:camel-dev.properties" />

    </bean>
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <endpoint id="devOdePatientService" uri="${dev2hub1odepatientservice.uri}"></endpoint>
                 <route errorHandlerRef="myDeadLetterErrorHandler">
                         <from uri="activemq:topic:topic.PATIENT?clientId=camelClientPatient&amp;durableSubscriptionName=patientTopicSubscriber"/>
             <to uri="bean:soapMessageCreator"/>
        <multicast >
        <pipeline>
                                    <setHeader headerName="endpointURL">
                                          <constant>${dev2hub1odepatientservice.uri}</constant>
                                    </setHeader>
                                    <to ref="devOdePatientService"/>
                             </pipeline>
                     </multicast>
        </route>
        <route>
      <from uri="activemq:topic:topic.TEST1"/>
      <to uri="activemq:topic:topic.TEST"/>
    </route>
       
  </camelContext>
Reply | Threaded
Open this post in threaded view
|

Re: using properties file

terminator_008
Hi,
I am able to use create the endpoints by reading the values from properties file as
<endpoint id="devOdePatientService" uri="${dev2hub1odepatientservice.uri}"></endpoint>

However I am not able to set the value of the endpoint uri (${dev2hub1odepatientservice.uri}) in the header which is a requirement in my case.
Can you please suggest how this can be achieved.

             <pipeline>
                                    <setHeader headerName="endpointURL">
                                          <constant>${dev2hub1odepatientservice.uri}</constant>
                                    </setHeader>
                                    <to ref="devOdePatientService"/>
                             </pipeline>


tide08 wrote
It is known issue, you cannot use properties in camelContext tag but there are ways to achieve this. See below thread for more details -

http://old.nabble.com/reading-endpoints-from-a-properties-file-td25894947.html#a25895352

Thanks!

terminator_008 wrote
Hi, I am reading some values from a property file in the camel -config.
I want to be able to use ${dev2hub1odepatientservice.uri} in the Pipeline set header element. But it does not work.
Here is my camel-config file. Would appreciate any pointers.
       <bean id="test" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="location" value="classpath:camel-dev.properties" />

    </bean>
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
      <endpoint id="devOdePatientService" uri="${dev2hub1odepatientservice.uri}"></endpoint>
                 <route errorHandlerRef="myDeadLetterErrorHandler">
                         <from uri="activemq:topic:topic.PATIENT?clientId=camelClientPatient&amp;durableSubscriptionName=patientTopicSubscriber"/>
             <to uri="bean:soapMessageCreator"/>
        <multicast >
        <pipeline>
                                    <setHeader headerName="endpointURL">
                                          <constant>${dev2hub1odepatientservice.uri}</constant>
                                    </setHeader>
                                    <to ref="devOdePatientService"/>
                             </pipeline>
                     </multicast>
        </route>
        <route>
      <from uri="activemq:topic:topic.TEST1"/>
      <to uri="activemq:topic:topic.TEST"/>
    </route>
       
  </camelContext>