I want to configure a poller for my mail adapter, to run just once or run it programmatically.
This is a standalone app (java -jar xxxx.jar)
, so I think maybe one option is configure the fixed-rate
attribute, to an arbitrary max value and then exit the application, ie: System.exit(0)
.
Are there more alternatives or some kind of 'correct approach', for this case?
This is my integration-context.xml
:
<int-mail:inbound-channel-adapter id="imapAdapter"
store-uri="imaps://${imap.user}:${imap.password}@${imap.server.ip}:${imap.server.port}/inbox"
channel="receiveChannel"
auto-startup="true"
should-delete-messages="false"
should-mark-messages-as-read="false"
java-mail-properties="javaMailProperties"
mail-filter-expression="subject matches '(?i)*UNSUSCRIBE*'">
<int:poller max-messages-per-poll="1" fixed-rate="5000"/>
</int-mail:inbound-channel-adapter>
PS: Unfortunately imap-idle-channel-adapter
is not an option.