如何使用spring集成将邮件存储到数组列表对象或数据库中?

问题描述 投票:0回答:1

我需要将邮件存储到一个收集对象或数据库中,以便进行邮件处理。以下是可以显示邮件的代码,谁能告诉我如何将邮件保存到收集对象(ArrayList)或数据库中。

public void startMail(String user, String pw) {
        IntegrationFlow flow = IntegrationFlows
                .from(Mail.imapInboundAdapter(imapUrl(user, pw))
                        .javaMailProperties(p -> p
                            .put("mail.debug", "true")
                            .put("mail.imap.connectionpoolsize", "1")
                            .put("mail.imap.socketFactory.class", javax.net.ssl.SSLSocketFactory.class)
                            .put("mail.imap.socketFactory.fallback", false)
                            .put("mail.store.protocol", "imaps"))
                        .simpleContent(true)

                    , c -> c.poller(Pollers.fixedRate(60000)))

                    .handle(System.out::println)
                    .get();
        this.flowContext.registration(flow).register();
      }
spring-integration imap
1个回答
0
投票

不知道你要做什么和如何与一些集合,但要存储到数据库,你需要使用各自的 JdbcMessageHandler 通道适配器 .handle().

更多信息请参见docs。

https:/docs.spring.iospring-integrationdocscurrentreferencehtmljdbc.html#jdbc-outbound-channel-adapter。

https:/docs.spring.iospring-integrationdocscurrentreferencehtmldsl.html#java-dsl-protocol-adapters。

© www.soinside.com 2019 - 2024. All rights reserved.