2

私は春の統合を使用して imap を使用して電子メールを取得しています。私の構成は次のとおりです。春の統合バージョン 1.0.4.RELEASE を使用しています。私の春のバージョンは変更したくない 2.5 であるため、このバージョンに固執しています (かなりの努力が必要です)。

質問 次の属性のいずれかを inbound-channel-adapter に配置すると、次の例外が発生します。should-delete-messages="false" should-mark-messages-as-read="true"

スレッド「メイン」での例外 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: クラスパス リソース [META-INF/spring/component.xml] からの XML ドキュメントの 125 行目が無効です。ネストされた例外は org.xml.sax.SAXParseException です: cvc-complex-type.3.2.2: 属性 'should-delete-messages' は、要素 'mail:inbound-channel-adapter' に表示できません。

また、メールを処理するたびに、対応するメールが Outlook メールボックスから削除されます。この属性はバージョン 1.0.4 ではサポートされていませんか? はいの場合、同様の機能を実現する方法は?

<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>

<mail:inbound-channel-adapter id="imapAdapter"
                                  store-uri="imaps://username:password@mydomain:993/inbox"                                    
                                  channel="recieveEmailChannel"
                                  auto-startup="true"
                                  java-mail-properties="javaMailProperties">
    <int:poller> 
    <int:interval-trigger initial-delay="1000" interval="2000"
    fixed-rate="true"/>
    </int:poller>
</mail:inbound-channel-adapter>
<int:channel id="recieveEmailChannel" />        
<int:service-activator input-channel="recieveEmailChannel" ref="emailReceiverService" method="receive"/>
<bean id="emailReceiverService" class="com.mydomain.email.in.DefaultEmailReceiverUtilService">
</bean>
4

1 に答える 1

1

次のように、inbound-channel-adapterの代わりにimap-idle-channel-adapterを使用することで解決しました。

<mail:imap-idle-channel-adapter id="imapAdapter"
                                  store-uri="imaps://username:password@mydomain:993/inbox"                                    
                                  channel="recieveEmailChannel"
                                  should-delete-messages="false"
                                  auto-startup="true"
                                  java-mail-properties="javaMailProperties" />
于 2012-12-19T10:12:32.017 に答える