javaemailapache-camelpolling

How to adjust the polling frequency for imap using camel mail


As an experiment I have a simple java application using email for message transport. I want to use camel to connect this application to another application using a different kind of communication.

I created a simple email-to-file route in camel running a local email server (citadel). The following code seams to work fine but it takes quite a while till the email arrives as a file after arriving in the inbox on the server.

from("imap://192.168.178.42:143?username=email1&password=thePassword")
//"file:C:/inputFolder?move=./done"             
.to("file:C:/mailOutputFolder");

I guess I need to change the polling frequency of camel. How can I achieve that? Thanks


Solution

  • You can try something like:

    from("imap://192.168.178.42:143?username=email1&password=thePassword&delay=5")//"file:C:/inputFolder?move=./done"
    .to("file:C:/mailOutputFolder");
    

    In the above case, I have added delay=5, to signify polling every 5 seconds.

    Or you can try:

    from("imap://192.168.178.42:143?username=email1&password=thePassword&")//"file:C:/inputFolder?move=./done"
    .delay("time").to("file:C:/mailOutputFolder");