【问题标题】:spring integration: how to aggregate all new email messages and count it春季集成:如何汇总所有新电子邮件并进行计数
【发布时间】:2019-06-04 03:41:41
【问题描述】:

我正在开发一个每周从 IMAP 服务器接收电子邮件并生成相关统计信息的应用程序。其中之一是具有相同主题的电子邮件数量。

我正在考虑使用重新排序器来存储来自服务器的所有消息,并在收到所有新消息时生成统计信息并最终单独发送消息。

但是我错过了sequence_numbercorrelation_id,当消息在服务器上结束时,我找不到合适的方法来释放组。

这是我的integration-context.xml

<int:channel id="startMailSync"/>
<int:control-bus id="start" input-channel="startMailSync"/>

<int:channel id="receiveChannel" datatype="javax.mail.internet.MimeMessage" />
<int-mail:inbound-channel-adapter 
    id="mailClient"
    channel="receiveChannel" 
    java-mail-properties="javaMailProperties"
    store-uri="imaps://[user]:[password]@mail.it/INBOX"
    should-mark-messages-as-read="true"
    should-delete-messages="false"
    mail-filter-expression="from[0].address matches 'sender@sender.it'"
    auto-startup="false">

    <int:poller trigger="runOnceTrigger" max-messages-per-poll="100"/>
</int-mail:inbound-channel-adapter>

<util:properties id="javaMailProperties">
    <prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
    <prop key="mail.imap.socketFactory.fallback">false</prop>
    <prop key="mail.store.protocol">imaps</prop>
    <prop key="mail.debug">false</prop>
</util:properties>

<int:resequencer 
    input-channel="receiveChannel" 
    output-channel="a"
 >

【问题讨论】:

    标签: xml spring spring-integration


    【解决方案1】:

    您应该使用聚合器而不是重新排序器;您可以使用自定义关联策略/表达式(例如,在主题上关联)和自定义发布策略/表达式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-10
      • 2019-08-18
      • 2018-04-27
      • 2017-07-28
      • 2019-08-05
      • 1970-01-01
      • 2017-09-18
      相关资源
      最近更新 更多