Apache Camel Mail组件接收器示例不起作用

时间:2019-05-01 05:59:39

标签: apache-camel spring-camel apache-camel-mail

我正在尝试使用Spring Boot编写Apache Camel Mail组件接收器。这是我编写的代码:

@Component
public class MyEmailRouter extends RouteBuilder {

    @Override
    public void configure() throws Exception {
         from("imaps://imap.gmail.com?username=XXX&password=XXX&consumer.delay=60000&delete=false&unseen=true&debugMode=false&searchTerm.fromSentDate=now-24h&searchTerm.unseen=true")
            .to("log:newmail");
    }
}

我正在尝试获取过去24小时内所有未看到的电子邮件。但是,这没有记录任何内容。

当我在URL中添加debugMode = true时,得到以下日志:

    DEBUG IMAPS: mail.imap.fetchsize: 16384
    DEBUG IMAPS: mail.imap.ignorebodystructuresize: false
    DEBUG IMAPS: mail.imap.statuscachetimeout: 1000
    DEBUG IMAPS: mail.imap.appendbuffersize: -1
    DEBUG IMAPS: mail.imap.minidletime: 10
    DEBUG IMAPS: closeFoldersOnStoreFailure
    DEBUG IMAPS: trying to connect to host "imap.gmail.com", port 993, isSSL true
    * OK Gimap ready for requests from 111.122.212.118 b2mb183242253ioa
    A0 CAPABILITY
    * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH
    A0 OK Thats all she wrote! b2mb183242253io
    DEBUG IMAPS: AUTH: XOAUTH2
    DEBUG IMAPS: AUTH: PLAIN
    DEBUG IMAPS: AUTH: PLAIN-CLIENTTOKEN
    DEBUG IMAPS: AUTH: OAUTHBEARER
    DEBUG IMAPS: AUTH: XOAUTH
    DEBUG IMAPS: protocolConnect login, host=imap.gmail.com, user=<non-null>, password=<non-null>
    DEBUG IMAPS: AUTHENTICATE PLAIN command trace suppressed
    DEBUG IMAPS: AUTHENTICATE PLAIN command result: A1 OK USERNAME authenticated (Success)
    A2 ENABLE UTF8=ACCEPT
    * ENABLED UTF8=ACCEPT
    A2 OK Success
    A3 LIST "" INBOX
    * LIST (\HasNoChildren) "/" "INBOX"
    A3 OK Success
    DEBUG IMAPS: connection available -- size: 1
    A4 SELECT INBOX
    * FLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing)
    * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing \*)] Flags permitted.
    * OK [UIDVALIDITY 1] UIDs valid.
    * 2804 EXISTS
    * 0 RECENT
    * OK [UIDNEXT 2811] Predicted next UID.
    * OK [HIGHESTMODSEQ 310772]
    A4 OK [READ-WRITE] INBOX selected. (Success)
    A5 FETCH 1 (FLAGS)
    * 1 FETCH (FLAGS ())
    A5 OK Success
    A6 FETCH 1 (ENVELOPE INTERNALDATE RFC822.SIZE)
    2019-05-01 11:20:56.451  INFO 3100 --- [       Thread-2] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.23.2 (CamelContext: MyCamel) is shutting down
    2019-05-01 11:20:56.452  INFO 3100 --- [       Thread-2] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
    2019-05-01 11:20:56.455  INFO 3100 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 300 seconds. Inflights per route: [route1 = 1]
    * 1 FETCH (RFC822.SIZE 4844 INTERNALDATE "31-Oct-2017 12:57:31 +0000" ENVELOPE ("Tue, 31 Oct 2017 05:57:31 -0700" "The best of Gmail, wherever you are" (("Gmail Team" NIL "mail-noreply" "google.com")) (("Gmail Team" NIL "mail-noreply" "google.com")) (("Gmail Team" NIL "mail-noreply" "google.com")) (("Aks" NIL "aks" "xyz.com")) NIL NIL NIL "<CAEDUrjNBDqUCUMGHVZ2x=gZ0Se5=e2jjp8hpkBECdDwqt_rfmw@mail.gmail.com>"))
    A6 OK Success
    A7 FETCH 2 (FLAGS)
    * 2 FETCH (FLAGS ())

0 个答案:

没有答案