更改骆驼中的交换内容

change exchange content in camel

我正在尝试使用 camel 实现如下场景:-

  1. 从 JMS 队列获取文件。

  2. 将文件和文件的crc值存放在一个目录下

  3. 将文件和crc文件移动到SFTP服务器,一旦成功 从目录中删除文件。

我的路线如下

from("jms:queue")
 .to(save the file)
 .process(since I have the content of the file in exchange so generating crc)
 .to(file system save the crc file)
 .to(Push both the files to the sftp server);

但是上传到 sftp 服务器的文件只是交换中存在的 crc 文件。 我应该如何解决这种情况? 如果你们中的任何人遇到过这个问题,请指导我。 谢谢

我认为你应该使用 wire tap 将交换复制到不同的路由,并让新路由保存文件并将其 sftp 到正确的位置。

from("jms:queue")
  .wireTap("direct:save-file")
  .process(since I have the content of the file in exchange so generating crc)
  .to(file system save the crc file)
  .to(Push file to the sftp server);

from("direct:save-file")
  .to(save the file)
  .to(Push file to the sftp server);