Beena Rautela
Beena Rautela

Reputation: 53

The camel message exchange property is not being resolved when used in validator uri component

I am trying to validate the xml file against the xsd using the validator component of camel using blueprint DSL.

<to id="validateXML" uri="validator:file:D:/data/schema/flow.xsd" /> --> working

<to id="validateXML" uri="validator:file:${property.flowXsdPath}" />  --> Not working

flowXsdPath is an exchange property which is set to the xsd location defined by the variable xsdPathVar as given below:

exchange.setProperty("flowXsdPath", exchange.getContext().resolvePropertyPlaceholders(xsdPathVar));

I get exception "Failed to create Producer for endpoint: Endpoint[validator://file:$%7Bproperty.flowXsdPath%7D]. Reason: java.io.FileNotFoundException: ${property.flowXsdPath} (The system cannot find the file specified)"

Though I can access the property value in a log message just before validating the xml file, like this

<log message="File ${file:name} XSD Location = ${property.flowXsdPath}" /> 

2017-10-16 11:48:44,037 | INFO  | processXMLFiles] | file-jms-hums-route              | ID-ITEM-XXXXX-49898-1508134722113-0-3 | File 20150603-161237-A412-MFSC.xml XSD Location = D:/data/schema/FSC.xsd

Could you please help how can I access this property inside validator file component?

Upvotes: 3

Views: 1123

Answers (1)

ltsallas
ltsallas

Reputation: 1948

You should use Dynamic To <toD> instead of <to> to send a message to a dynamic computed Endpoint.

See the related section in http://camel.apache.org/message-endpoint.html

Upvotes: 5

Related Questions