简体   繁体   English

如何更改m子的imap邮件提取顺序?

[英]how to change mule's imap mail fetch order?

I have an IMAP connection to fetch emails using Mule. 我有一个IMAP连接,可以使用Mule获取电子邮件。 I'm running into an issue. 我遇到了一个问题。

Here are my 2 simple requirements: 这是我的两个简单要求:

  1. I want to fetch emails in reverse order. 我想以相反的顺序获取电子邮件。 (latest first) (最新)
  2. Ignore SEEN messages but don't delete them. 忽略SEEN消息,但不要删除它们。

I was looking at the code that mule (3.3.1) uses: org.mule.transport.email.RetrieveMessageReceiver.poll(). 我正在查看m子(3.3.1)使用的代码:org.mule.transport.email.RetrieveMessageReceiver.poll()。

The code seems to be fetching messages from message 1. 该代码似乎正在从消息1中获取消息。

348: Message[] messages = folder.getMessages(1, batchSize);

The messages fetched here are processed in a loop in : 此处获取的消息将在以下循环中处理:

org.mule.transport.email.RetrieveMessageReceiver.messagesAdded(MessageCountEvent) org.mule.transport.email.RetrieveMessageReceiver.message☎联系人(MessageCountEvent)

142: if (!messages[i].getFlags().contains(Flags.Flag.DELETED)
143:      && !messages[i].getFlags().contains(Flags.Flag.SEEN))

What this whole logic is doing is that it is trying to read OLD unread messages. 整个逻辑所要做的是,它试图读取OLD未读消息。 The code comes back to line 348 and executes 该代码返回到第348行并执行

folder.getMessages(1, batchSize);

again, and gets the same messages and it keeps on waiting. 再次,并获得相同的消息,并继续等待。 How can i change the order of fetch. 如何更改获取顺序。

FYI: Using MS Exchange for IMAP 仅供参考:使用MS Exchange for IMAP

Not sure why you say that Mule tried to read "OLD unread messages"? 不确定为什么您说Mule尝试阅读“旧的未读邮件”? It actually just tries to read unread messages, ie not DELETED nor SEEN. 它实际上只是尝试读取未读的消息,即不删除也不看。

Anyway, theoretically the Mulesque way of sorting the messages would be to use resequencer . 无论如何,理论上对消息进行排序的Mulesque方法将是使用resequencer Unfortunately the mail message receivers do not set any of the required control properties to let Mule process the received messages as a single batch so that won't work. 不幸的是,邮件消息接收者没有设置任何必需的控件属性,以使Mule可以单批处理接收到的消息,从而无法正常工作。

So the only solution I can think of is to extend org.mule.transport.email.RetrieveMessageReceiver and register your custom version on the IMAP connector with a <service-overrides /> child element. 因此,我唯一想到的解决方案是扩展org.mule.transport.email.RetrieveMessageReceiver并使用<service-overrides />子元素在IMAP连接器上注册您的自定义版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM