一个用于多个电子邮件地址的电子邮件入站适配器
One email inbound adapter for multiple email address
我们有 200 多个电子邮件地址用于与我们的客户进行集成,并且大多数电子邮件处理逻辑都是相同的,我们希望将这些电子邮件迁移到 Spring 集成入站电子邮件适配器,但是我们不想重复复制和粘贴以下代码片段
<int-mail:imap-idle-channel-adapter id="mailAdapter"
store-uri="${uri}"
channel="emailInboundChannel"
auto-startup="true"
should-delete-messages="false"
search-term-strategy="unseenSearchTermStrategy"
java-mail-properties="javaMailProperties">
<int-mail:transactional synchronization-factory="syncFactory" transaction-manager="transactionManager"/>
</int-mail:imap-idle-channel-adapter>
有没有什么方法可以只使用一个带有固定速率轮询器的电子邮件适配器来连接尽可能多的电子邮件地址,然后将电子邮件消息发送到同一个入站通道?
如果您可以移动到 Java 和注释配置,尤其是 Java DSL,那么您可以获得动态流的收益:https://docs.spring.io/spring-integration/docs/5.3.1.RELEASE/reference/html/dsl.html#java-dsl-runtime-flows。因此,您可以遍历您的电子邮件并为它们注册 IMAP 通道适配器。
使用 XML 配置真的很难做到...
尽管您可以考虑使用 spring-integration-flow 扩展:https://github.com/spring-projects/spring-integration-flow,但最近确实建议迁移到 Java 配置。
我们有 200 多个电子邮件地址用于与我们的客户进行集成,并且大多数电子邮件处理逻辑都是相同的,我们希望将这些电子邮件迁移到 Spring 集成入站电子邮件适配器,但是我们不想重复复制和粘贴以下代码片段
<int-mail:imap-idle-channel-adapter id="mailAdapter"
store-uri="${uri}"
channel="emailInboundChannel"
auto-startup="true"
should-delete-messages="false"
search-term-strategy="unseenSearchTermStrategy"
java-mail-properties="javaMailProperties">
<int-mail:transactional synchronization-factory="syncFactory" transaction-manager="transactionManager"/>
</int-mail:imap-idle-channel-adapter>
有没有什么方法可以只使用一个带有固定速率轮询器的电子邮件适配器来连接尽可能多的电子邮件地址,然后将电子邮件消息发送到同一个入站通道?
如果您可以移动到 Java 和注释配置,尤其是 Java DSL,那么您可以获得动态流的收益:https://docs.spring.io/spring-integration/docs/5.3.1.RELEASE/reference/html/dsl.html#java-dsl-runtime-flows。因此,您可以遍历您的电子邮件并为它们注册 IMAP 通道适配器。
使用 XML 配置真的很难做到...
尽管您可以考虑使用 spring-integration-flow 扩展:https://github.com/spring-projects/spring-integration-flow,但最近确实建议迁移到 Java 配置。