Apache camel ftp component - notification on successful transfer

880 views Asked by At

We are in the process of building a Java application with Camel to transfer files between two FTP locations. Is there a way to get a notification on the successful transfer of a file? We are not allowed to use a JMS solution for building the application.

1

There are 1 answers

0
Naveen Raj On BEST ANSWER

I hope you could create another route and have seda/vm as the endpoint.This endpoint needs to be called after the ftp endpoint.

<route id="MainRoute">
<from uri="ftp:RemoteLocation"/> 
<from uri="seda:Retry"/>
<to uri="seda:MyLog"/>
<!--Your Main Processing logic -->
</route>

<route id="Notification-processor">
<from uri="seda:MyLog"/>
<!--Your Logging/Notification Processing logic -->
</route>

In the above scenario of Notification-processor you can have your custom notificaiton/log activity. This is your custom notification logic. If you need to notify for anomalies you can have a to endpoint in the Notification-processor for sending the notification.

You need to write logic to check if the message is complete if not you can have a bean called in the Notification-processor which can have dynamic route to extract the specific file form the ftp location and reprocess it. Like below

<route id="Notification-processor">
<from uri="seda:MyLog"/>
<!--Anomaly checker  -->
<to uri="seda:Retry"/>
<!--Your Logging/Notification Processing logic -->
</route>