简体   繁体   English

使用apache camel删除远程目录

[英]delete remote directory using apache camel

I came across Apache Camel today as I was thinking about implementing some basic Java routines for copying a directory to a remote server, and then running an MPI job, then on completion of the MPI job, deleting that directory.今天我遇到了 Apache Camel,因为我正在考虑实现一些基本的 Java 例程,用于将目录复制到远程服务器,然后运行 ​​MPI 作业,然后在 MPI 作业完成后,删除该目录。 However, it seems more difficult than I thought - I spent the whole afternoon today simply trying to copy a directory to a remote machine via sftp (I still can't get it to copy a single file ).然而,这似乎比我想象的要困难 - 我今天整个下午都在尝试通过 sftp 将目录复制到远程机器(我仍然无法复制单个文件)。

Basically, I'm wondering if Apache Camel is really the best java library/solution I should be using for my problem (as stated in my first sentence).基本上,我想知道 Apache Camel 是否真的是我应该用于解决问题的最佳 Java 库/解决方案(如我的第一句话中所述)。 I envisage mostly sftp/ssh communications (and on windows - through usual file sharing in an internal network), but may change this according to requirements.我设想主要是 sftp/ssh 通信(在 Windows 上 - 通过内部网络中的通常文件共享),但可能会根据要求进行更改。 Perhaps Apache Camel doesn't fit my requirements, or is using a sledgehammer to crack a nut?也许 Apache Camel 不符合我的要求,或者正在使用大锤敲碎坚果?

I would be grateful for any comments - unfortunately my networking knowledge is pretty limited outside basic usage.我将不胜感激任何评论 - 不幸的是,我的网络知识在基本使用之外非常有限。

Thanks!谢谢!

不,您不能使用 Camel ftp 组件删除远程目录。

Camel is more designed to handle continuously mediations of files/messages than doing such batch jobs. Camel 更适合处理文件/消息的连续中介,而不是执行此类批处理作业。

I would probably implement the logic concerning directory creation/removal in pure java, using the JSCH library.我可能会使用JSCH库在纯 Java 中实现有关目录创建/删除的逻辑。

You can still use Camel to trigger/control the process - while implementing directory removal/creation/processing stuff in java.您仍然可以使用 Camel 来触发/控制过程 - 同时在 java 中实现目录删除/创建/处理内容。 This could be great if you want to trigger this process using http or using a timer.如果您想使用 http 或使用计时器触发此过程,这可能会很棒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM