【问题标题】:Mule ESB 3.3 - Receiving IMAPS mail (Gmail)Mule ESB 3.3 - 接收 IMAPS 邮件 (Gmail)
【发布时间】:2013-01-07 04:52:08
【问题描述】:

谁有从 Gmail 中通过 SSL (IMAPS) 读取 IMAP 邮件的工作示例?

我收集了一些信息,但没有成功:

那东西只是坐在那里无所事事。

这是我的流程:

<mule>
<imaps:connector
        name="imapsConnector"
        checkFrequency="5000"
        backupEnabled="true"
        mailboxFolder="INBOX"
        deleteReadMessages="false"
        doc:name="IMAP">
        <imaps:tls-client />
        <imaps:tls-trust-store />
    </imaps:connector>

    <expression-transformer
        name="returnAttachments"
        doc:name="Expression">
        <return-argument
            evaluator="attachments-list"
            expression="*.csv" />
    </expression-transformer>

    <flow
        name="GmailImapsFetch"
        doc:name="Flow1_IMAP_fetch">
        <imaps:inbound-endpoint
            user="your_username%40gmail.com"
            password="your_password"
            host="imap.googlemail.com"
            port="993"
            transformer-refs="returnAttachments"
            disableTransportTransformer="true"
            doc:name="IMAP"
            connector-ref="imapsConnector"
            responseTimeout="10000" />
        <!-- <collection-splitter doc:name="Collection Splitter" /> -->
        <logger message="#[payload]" />
        <file:outbound-endpoint
            path="/tmp/gmail-#[function:datestamp].dat"
            doc:name="File">
            <expression-transformer>
                <return-argument
                    expression="payload.inputStream"
                    evaluator="groovy" />
            </expression-transformer>
        </file:outbound-endpoint>

    </flow>
</mule>

Mule Studio (1.3.2) 抱怨 XML 格式错误(它不喜欢表达式转换器的东西),但它在运行时不会抱怨。

有人在运行吗?

谢谢。

--

日志:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Starting app 'mulelab'                                   +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[23-01-13 11:07:01] [DEBUG] Applying lifecycle phase: org.mule.lifecycle.phases.MuleContextStartPhase@14b03ea for registry: DefaultRegistryBroker
[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: org.mule.util.queue.TransactionalQueueManager@63edf84f
[23-01-13 11:07:01] [ INFO] Starting ResourceManager
[23-01-13 11:07:01] [DEBUG] Restore retrieved 0 objects
[23-01-13 11:07:01] [DEBUG] Restore retrieved 0 objects
[23-01-13 11:07:01] [DEBUG] Restore retrieved 0 objects
[23-01-13 11:07:01] [ INFO] Started ResourceManager
[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: FileConnector
. . .   
[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: ImapsConnector
{
  name=imapsConnector
  lifecycle=initialise
  this=4bb4df9c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=false
  supportedProtocols=[imaps]
  serviceOverrides=<none>
}

[23-01-13 11:07:01] [DEBUG] Connecting: ImapsConnector
{
  name=imapsConnector
  lifecycle=initialise
  this=4bb4df9c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=false
  supportedProtocols=[imaps]
  serviceOverrides=<none>
}

[23-01-13 11:07:01] [ INFO] Connected: ImapsConnector
{
  name=imapsConnector
  lifecycle=initialise
  this=4bb4df9c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[imaps]
  serviceOverrides=<none>
}

[23-01-13 11:07:01] [ INFO] Starting: ImapsConnector
{
  name=imapsConnector
  lifecycle=initialise
  this=4bb4df9c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[imaps]
  serviceOverrides=<none>
}

[23-01-13 11:07:01] [ INFO] Starting connector: imapsConnector
[23-01-13 11:07:01] [DEBUG] Successfully connected to ImapsConnector
{
  name=imapsConnector
  lifecycle=initialise
  this=4bb4df9c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=false
  supportedProtocols=[imaps]
  serviceOverrides=<none>
}

[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: org.mule.transport.servlet.jetty.JettyWebappServerAgent@26945b95
[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: org.mule.module.management.agent.JmxAgent@320f6398
[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: SedaModel{_muleSystemModel}
[23-01-13 11:07:01] [ INFO] Starting model: _muleSystemModel
[23-01-13 11:07:01] [DEBUG] lifecycle phase: start for object: Flow{GmailImapsFetch}
[23-01-13 11:07:01] [ INFO] Starting flow: GmailImapsFetch
[23-01-13 11:07:01] [ INFO] Starting service: GmailImapsFetch.stage1
[23-01-13 11:07:01] [ INFO] Registering listener: GmailImapsFetch on endpointUri: imaps://your_username%40gmail.com:****@imap.googlemail.com:993
[23-01-13 11:07:01] [ INFO] Loading default inbound transformer: org.mule.transport.email.transformers.EmailMessageToString
[23-01-13 11:07:01] [DEBUG] Setting transformer name to: EmailMessageToString#1868577756
[23-01-13 11:07:01] [ INFO] Initialising: 'null'. Object is: RetrieveMessageReceiver
[23-01-13 11:07:01] [DEBUG] Connecting: RetrieveMessageReceiver{this=22fe135d, receiverKey=your_username@gmail.com, endpoint=imaps://your_username%40gmail.com:****@imap.googlemail.com:993}
[23-01-13 11:07:01] [ INFO] Connecting clusterizable message receiver
[23-01-13 11:07:01] [DEBUG] No Authenticator set on connector: imapsConnector; using default.
[23-01-13 11:07:01] [ INFO] Defaulting mule.email.imaps trust store to client Key Store
[23-01-13 11:07:01] [DEBUG] MuleSession local properties =============
[23-01-13 11:07:01] [DEBUG] mail.imaps.ssl: true
[23-01-13 11:07:01] [DEBUG] mail.debug: true
[23-01-13 11:07:01] [DEBUG] mail.imaps.socketFactory.class: org.mule.transport.email.ImapsSocketFactory
[23-01-13 11:07:01] [DEBUG] mail.imaps.socketFactory.fallback: false
[23-01-13 11:07:01] [DEBUG] mail.imap.host: imap.googlemail.com
[23-01-13 11:07:01] [DEBUG] mail.imap.auth: true
[23-01-13 11:07:01] [DEBUG] mail.imap.socketFactory.port: 993
[23-01-13 11:07:01] [DEBUG] mail.imap.rsetbeforequit: true
[23-01-13 11:07:01] [DEBUG] skipped 0
[23-01-13 11:07:01] [DEBUG] System global properties =============
[23-01-13 11:07:01] [DEBUG] mule.home: /home/pakmans/workspace/.mule
[23-01-13 11:07:01] [DEBUG] mule.encoding: UTF-8
[23-01-13 11:07:01] [DEBUG] skipped 57
[23-01-13 11:07:01] [DEBUG] Creating mail session: host = imap.googlemail.com, port = 993, user = your_username@gmail.com, pass = ********
[23-01-13 11:07:01] [DEBUG] creating: true; mule.email.imaps
[23-01-13 11:07:01] [DEBUG] creating factory
[23-01-13 11:07:01] [ INFO] Using org.mule.api.security.provider.SunSecurityProviderInfo
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.trustStore -> null
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.trustStoreType -> jks
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.trustStorePassword -> null
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.trustManagerAlgorithm -> SunX509
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.keyStore -> .keystore
[23-01-13 11:07:01] [DEBUG] Unable to load resource from the file system: /home/pakmans/workspace/mulelab/.keystore
[23-01-13 11:07:01] [DEBUG] Unable to load resource .keystore from the classpath
[23-01-13 11:07:01] [DEBUG] Normalised keyStore path to: null
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.keyStoreType -> jks
[23-01-13 11:07:01] [DEBUG] mule.email.imaps.ssl.keyStorePassword -> null
[23-01-13 11:07:01] [DEBUG] initialising: anon true
[23-01-13 11:07:01] [ INFO] Defaulting mule.email.imaps trust store to client Key Store
[23-01-13 11:07:03] [DEBUG] Connected: imaps://your_username%40gmail.com:****@imap.googlemail.com:993
[23-01-13 11:07:03] [ INFO] Starting: 'null'. Object is: RetrieveMessageReceiver
[23-01-13 11:07:03] [ INFO] Starting clusterizable message receiver
[23-01-13 11:07:03] [DEBUG] RetrieveMessageReceiver@22fe135d scheduled ScheduledThreadPoolExecutor$ScheduledFutureTask@6fa37fac with 5000 MILLISECONDS polling frequency
[23-01-13 11:07:03] [DEBUG] lifecycle phase: start for object: DefaultInboundEndpoint{endpointUri=imaps://your_username%40gmail.com:<password>@imap.googlemail.com, connector=ImapsConnector
{
  name=imapsConnector
  lifecycle=start
  this=4bb4df9c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[imaps]
  serviceOverrides=<none>
}
,  name='endpoint.imaps.your_username.gmail.com', mep=ONE_WAY, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=true}
[23-01-13 11:07:03] [DEBUG] lifecycle phase: start for object: org.mule.DefaultMuleContext@6a9effe0
[23-01-13 11:07:03] [ INFO] Reload interval: 3000
[23-01-13 11:07:03] [DEBUG] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'wrapper-manager' is defined
[23-01-13 11:07:03] [DEBUG] registering key/object wrapper-manager/org.mule.module.management.agent.WrapperManagerAgent@4c825cf3
[23-01-13 11:07:03] [DEBUG] applying processors
[23-01-13 11:07:03] [DEBUG] applying lifecycle to object: org.mule.module.management.agent.WrapperManagerAgent@4c825cf3
[23-01-13 11:07:03] [ INFO] This JVM hasn't been launched by the wrapper, the agent will not run.
[23-01-13 11:07:03] [DEBUG] Registering statistics with name: Mule.mulelab:type=Statistics,name=AllStatistics
[23-01-13 11:07:03] [DEBUG] Registering mule with name: Mule.mulelab:name=MuleContext
[23-01-13 11:07:03] [DEBUG] Registering configuration with name: Mule.mulelab:name=Configuration
[23-01-13 11:07:03] [DEBUG] Registering model with name: Mule.mulelab:type=Model,name="_muleSystemModel(seda)"
[23-01-13 11:07:03] [DEBUG] Registering service with name: Mule.mulelab:type=Flow,name="GmailImapsFetch"
[23-01-13 11:07:03] [DEBUG] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'endpoint.imaps.your_username.gmail.com' is defined
[23-01-13 11:07:03] [ INFO] Attempting to register service with name: Mule.mulelab:type=Endpoint,service="GmailImapsFetch",connector=imapsConnector,name="endpoint.imaps.your_username.gmail.com"
[23-01-13 11:07:03] [ INFO] Registered Endpoint Service with name: Mule.mulelab:type=Endpoint,service="GmailImapsFetch",connector=imapsConnector,name="endpoint.imaps.your_username.gmail.com"
[23-01-13 11:07:03] [DEBUG] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'connector.file.mule.default.1' is defined
[23-01-13 11:07:03] [DEBUG] Attempting to register service with name: Mule.mulelab:type=Connector,name="connector.file.mule.default.1"
[23-01-13 11:07:03] [ INFO] Registered Connector Service with name Mule.mulelab:type=Connector,name="connector.file.mule.default.1"
[23-01-13 11:07:03] [DEBUG] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'imapsConnector.1' is defined
[23-01-13 11:07:03] [DEBUG] Attempting to register service with name: Mule.mulelab:type=Connector,name="imapsConnector.1"
[23-01-13 11:07:03] [ INFO] Registered Connector Service with name Mule.mulelab:type=Connector,name="imapsConnector.1"
[23-01-13 11:07:03] [DEBUG] Registering application statistics with name: Mule.mulelab:type=Application,name="application totals"
[23-01-13 11:07:03] [ INFO] 
**********************************************************************
* Application: mulelab                                               *
* OS encoding: UTF-8, Mule encoding: UTF-8                           *
*                                                                    *
* Agents Running:                                                    *
*   JMX Agent                                                        *
**********************************************************************
[23-01-13 11:07:03] [ INFO] 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'mulelab'                                    +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

【问题讨论】:

  • 如果您使用 DEBUG 级别的日志运行,您会看到什么?
  • 谢谢,我试图查看接收器logger.debug("ignoring exception: " + e.getMessage()); 中的这条线是否被调用,但不是。了解更多关于我能想到的问题的唯一选择是在org.mule.transport.email.RetrieveMessageReceiver.poll() 中进行单步调试。我没有多余的 GMail 帐户,所以我不能自己做,抱歉。
  • 我已经调试了你建议的类,我可以看到它实际上确实连接并且它实际上检索了 7 条消息(为什么是 7 条?有超过 7 条),但它不断循环这 7 条消息。顺便说一句,这 7 条消息已被阅读,因此它没有任何作用。如果我将其标记为未读,您可以看到它继续流程。任何想法为什么它只读取 7(连续)?是否有必要获取所有邮件并检查它是否已经在本地阅读,而不是只要求未读邮件?任何指针将不胜感激。
  • @pakman,你有没有得到这个工作?我有类似的设置,但一直没有发生任何事情。
  • @Don01001100 是的,这是一个与语言相关的问题...请参阅我在大卫回答中的评论。

标签: ssl gmail imap esb mule


【解决方案1】:

我会冒险回答:$

根据IMAP's connector doc,您的配置似乎缺少 GMail 推荐的属性:

moveToFolder 读取邮件后要将邮件移动到的远程文件夹。 建议将“deleteReadMessages”设置为 false 用来。这在使用公共电子邮件服务时非常有用 例如 GMail,其中将邮件标记为删除不起作用。 而是设置@moveToFolder=[GMail]/Trash。

你可以试一试吗?

(已编辑:[Gmail] 必须用括号括起来)

【讨论】:

  • 我确实尝试过,但一开始没有用......在阅读了你的答案后,我尝试了更多,结果发现它没有用,因为我的 gmail 帐户(实际上是一个商业帐户,而不是plain gmail) 是西班牙语,所以我不得不使用:moveToFolder=[Gmail]/Papelera 我仍然有一个问题,如果收件箱中有已读邮件,mule 将在 oldes 7 中永远循环,永远不会到达未读邮件。跨度>
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-07
  • 2013-04-28
  • 1970-01-01
  • 1970-01-01
  • 2016-03-17
相关资源
最近更新 更多