So with Spring Integration, reading email is just few beans definition (in Grails Spring DSL):
integration.channel(id:'inboundEmailChannel')
mail.'inbound-channel-adapter'(id:"imapAdapter",
'store-uri':"imaps://${CH.config.logging.imap.credentials}@imap.gmail.com/INBOX",
'java-mail-properties':['mail.imap.socketFactory.class':'javax.net.ssl.SSLSocketFactory',
'mail.imap.socketFactory.fallback':false,
'mail.store.protocol':'imaps', 'mail.debug':false],
channel:"inboundEmailChannel",
'should-delete-messages':true,
'should-mark-messages-as-read':true,
'auto-startup':true) {
integration.poller('max-messages-per-poll':"1", 'fixed-rate':"5000")
}
integration.'service-activator'( 'input-channel':"inboundEmailChannel",
ref:"emailService", method:"inboundEmail")
So, with this, when you have incoming email, it will call
inboundEmail
method of emailService
.
No comments:
Post a Comment