How to use a value from a file with properties for a Camel component option value?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to use a value from a file with properties for a Camel component option value?

Mikhail Lukyanov
Hello everyone!

I need to specify as the value in the Camel component option the value from
the file with the properties, I thought it was done and as a property in
uri https://camel.apache.org/components/latest/properties-component.html.

I tried to do the following















*<bean
class="org.apache.camel.component.properties.PropertiesComponent"
factor:bean-type="DEFAULT" id="properties" name="properties">    <property
name="cache" value="false"/>    <property name="locations">        <list>
          <value>file:${CONF}/camel.properties</value>        </list>
</property></bean><bean
class="org.apache.camel.component.http4.HttpComponent"      id="http4"
name="http4">    <property name="socketTimeout"
value="${properties:camel_timeout}"/></bean>*

File with property content

*camel_timeout=60000*

But I get an error

*org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'http4' defined in URL [file:conf/sops/domain-beans.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert property
value of type 'java.lang.String' to required type 'int' for property
'socketTimeout'; nested exception is java.lang.NumberFormatException: For
input string: "camel_timeout"*

How can I use the value from the properties file for a component option
(maybe use Camel or Spring properties)?

--
*With best regards, Lukyanov Mikhail*
*Tel: **+7-909-69-71-547*