INT-1475, addressed the issue. Made 'should-delete-messages' required by the schema and added tests to validate it. Added more tests for Pop3MailReceiever. Modified documentation to explain the change and reasoning behind the change
This commit is contained in:
@@ -72,9 +72,9 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:mail="http://www.springframework.org/schema/integration/mail"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration/mail
|
||||
http://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd">]]></programlisting>
|
||||
http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd">]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
To configure an outbound Channel Adapter, provide the channel to receive from, and the MailSender:
|
||||
@@ -122,8 +122,28 @@
|
||||
</util:properties>]]></programlisting>
|
||||
</para>
|
||||
|
||||
<note>When using <emphasis>should-mark-messages-as-read</emphasis> be aware of the protocol you are using ti retrieve messages. For example POP3 does not support this flag
|
||||
which means setting it to 'true' will have no effect.</note>
|
||||
<important>
|
||||
In both configurations <code>channel</code> and <code>should-delete-messages</code> are the <emphasis>REQUIRED</emphasis>
|
||||
attributes. The important thing to understand is why <code>should-delete-messages</code> is required?
|
||||
The issue is with POP3 protocol, which does NOT have any knowlege of messages that were READ. It can only know what's been read
|
||||
within a single session. This means that when your POP3 mail adapter is running emails are successfully consumed as as they become available during each poll
|
||||
and no single email message will be delivered more then once. However, as soon as you restart your adapter and begin a new session
|
||||
all the email messages that might have been retreeved in the previous session will be retrieved again. That is the nature of POP3. Some might argue
|
||||
that why not set <code>should-delete-messages</code> to TRUE by default? Becouse there are two valid amd mutually exclusive use cases
|
||||
which makes it very hard pick the right default. You may want to configure your adapter as the only email receiever in which
|
||||
case you want to be able to restart such adapter without fear that messages that were delivered before will not be redelivered again.
|
||||
In this case setting <code>should-delete-messages</code> to TRUE would make most sence. However, you may have anoher use case where
|
||||
you may want to have multiple adapters that simply monitor email servers and their content. In other words you just want to 'peek but not touch'.
|
||||
Then setting <code>should-delete-messages</code> to FALSE would be much more appropriate. So since it is hard to choose what should be
|
||||
the right default value for <code>should-delete-messages</code> attribute we simply made it required to be set - leaving it up to you
|
||||
while also not letting you to forget that you must set it.
|
||||
</important>
|
||||
|
||||
<note>When configuring a polling adapter (e.g., inbound-channel-adapter) <emphasis>should-mark-messages-as-read</emphasis>
|
||||
be aware of the protocol you are configuring to retrieve messages. For example POP3 does not support this flag
|
||||
which means setting it to either value will have no effect as messages will NOT be marked as read</note>
|
||||
|
||||
|
||||
<para>
|
||||
When using the namespace support, a <emphasis>header-enricher</emphasis> Message Transformer is also available.
|
||||
This simplifies the application of the headers mentioned above to any Message prior to sending to the
|
||||
|
||||
Reference in New Issue
Block a user