作为实验,我有一个简单的 java 应用程序,使用电子邮件进行消息传输。我想使用 Camel 将此应用程序连接到使用不同类型通信的另一个应用程序。
我在运行本地电子邮件服务器(citadel)的camel中创建了一个简单的电子邮件到文件路由。以下代码工作正常,但电子邮件到达服务器收件箱后需要相当长的时间才能以文件形式到达。
from("imap://192.168.178.42:143?username=email1&password=thePassword")
//"file:C:/inputFolder?move=./done"
.to("file:C:/mailOutputFolder");
我想我需要改变camel的轮询频率。我怎样才能做到这一点?谢谢
最佳答案
您可以尝试以下操作:
from("imap://192.168.178.42:143?username=email1&password=thePassword&delay=5")//"file:C:/inputFolder?move=./done"
.to("file:C:/mailOutputFolder");
在上面的例子中,我添加了 delay=5
,表示每 5 秒轮询一次。
或者你可以尝试:
from("imap://192.168.178.42:143?username=email1&password=thePassword&")//"file:C:/inputFolder?move=./done"
.delay("time").to("file:C:/mailOutputFolder");
关于java - 如何使用 Camel 邮件调整imap的轮询频率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54668359/