You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by j_pramanik_ind <ja...@gmail.com> on 2017/02/08 09:51:24 UTC
Camel XML DSL for File transfer to endpoint on Condition
Hi All,
Is there any mechanism to handle file transfer from source folder to target
endpoint on the basis of specific condition ? In my case I'm using Apache
Camel 2.14.2 version in my application to handle incoming files for its
processing. I need to check a condition through java code in database table
data if it returns TRUE only then the routing process should work.
Here is my XML DSL -
<route id="route2">
<from uri="file:\\home\user27\BALITIKURI\reports?delete=true" />
<log message="INWARD DATA : [${body}]" />
<doTry>
<process ref="inwardProcessorCode" />
<doCatch>
<exception>java.io.IOException</exception>
<exception>java.lang.IllegalStateException</exception>
<exception>java.lang.Exception</exception>
</doCatch>
</doTry>
</route>
My requirement is to apply condition on the below XML DSL statement -
<from uri="file:\\home\user27\BALITIKURI\reports?delete=true" />
Is this possible ?
Kindly let me know. As this is urgently required.
Thanks in advance.
Jayanta P.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-transfer-to-endpoint-on-Condition-tp5793651.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel XML DSL for File transfer to endpoint on Condition
Posted by vrlgohel <vg...@redhat.com>.
Hi Jayanta,
Unless you are not making a connection to the Database from your processor
code, you can try setting a property in the camel exchange and validating
the result of that property with the result returned from the DB.
So, something like this,
from(file://someEndpoint).
setProperty("name", body())
Depending on what you need to check, you save the original exchange body in
a property and then you can access this from the processor code,
In the processor code,
public void process(final Exchange exchange) throws Exception {
Object body = exchange.getProperty("name");
}
On Wed, Feb 8, 2017 at 3:21 PM, j_pramanik_ind [via Camel] <
ml-node+s465427n5793651h94@n5.nabble.com> wrote:
> Hi All,
>
> Is there any mechanism to handle file transfer from source folder to
> target endpoint on the basis of specific condition ? In my case I'm using
> Apache Camel 2.14.2 version in my application to handle incoming files for
> its processing. I need to check a condition through java code in database
> table data if it returns TRUE only then the routing process should work.
>
>
> Here is my XML DSL -
>
> <route id="route2">
> <from uri="file:\\home\user27\
> BALITIKURI\reports?delete=true" />
> <log message="INWARD DATA : [${body}]" />
>
> <doTry>
> <process ref="inwardProcessorCode" />
>
> <doCatch>
>
> <exception>java.io.
> IOException</exception>
> <exception>java.lang.
> IllegalStateException</exception>
> <exception>java.lang.
> Exception</exception>
> </doCatch>
> </doTry>
> </route>
>
> My requirement is to apply condition on the below XML DSL statement -
>
> <from uri="file:\\home\user27\BALITIKURI\reports?delete=true" />
> Is this possible ?
>
> Kindly let me know. As this is urgently required.
>
> Thanks in advance.
>
> Jayanta P.
>
>
>
>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-
> transfer-to-endpoint-on-Condition-tp5793651.html
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=dmdvaGVsQHJlZGhhdC5jb218NDY1NDI4fDI5ODU5NzAwOA==>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-transfer-to-endpoint-on-Condition-tp5793651p5793682.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel XML DSL for File transfer to endpoint on Condition
Posted by j_pramanik_ind <ja...@gmail.com>.
I have done this by using filter. Filter returns the boolean and on that
basis Camel moves the file.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-transfer-to-endpoint-on-Condition-tp5793651p5793759.html
Sent from the Camel - Users mailing list archive at Nabble.com.