email - grails asynchronous mail service error -
our system sending email inside job using asynchronousmailservice
log.debug 'sending email ' + emailto asynchronousmailservice.sendmail { multipart true emailto.split("[,;]") bcc "test@bcc.com" "test@from.com" subject "test subject" html(view:'/email/testtemplate', model: [test: test]) attachbytes testid +".pdf" , 'application/pdf', invoicebytes } log.debug("invoice email sent.")
with following grails config:
grails { mail { host = "smtp.gmail.com" port = 465 username = "test@test.com" password = "password" props = ["mail.smtp.auth":"true", "mail.smtp.socketfactory.port":"465", "mail.smtp.socketfactory.class":"javax.net.ssl.sslsocketfactory", "mail.smtp.socketfactory.fallback":"false"] } } asynchronous.mail.default.attempt.interval = 300000l // 5 minutes asynchronous.mail.default.max.attempts.count = 1 asynchronous.mail.send.repeat.interval = 60000l // 1 minute asynchronous.mail.expired.collector.repeat.interval = 607000l asynchronous.mail.messages.at.once = 100 asynchronous.mail.send.immediately = true asynchronous.mail.override = false asynchronous.mail.clear.after.sent = false asynchronous.mail.disable = false asynchronous.mail.useflushonsave = true asynchronous.mail.persistence.provider = 'hibernate4' // possible values 'hibernate', 'hibernate4', 'mongodb' asynchronous.mail.gparspoolsize = 1 asynchronous.mail.newsessiononimmediatesend = false
i see these logs whenever sends emails:
2015-06-14 12:04:11,107 [forkjoinpool-4071-worker-1] debug asyncmail.asynchronousmailprocessservice - open new session. 2015-06-14 12:04:17,101 [forkjoinpool-4071-worker-1] debug asyncmail.asynchronousmailprocessservice - flush session. 2015-06-14 12:04:17,101 [forkjoinpool-4071-worker-1] debug asyncmail.asynchronousmailprocessservice - destroy session. 2015-06-14 12:04:17,101 [forkjoinpool-4071-worker-1] debug asyncmail.asynchronousmailprocessservice - open new session. 2015-06-14 12:04:23,125 [forkjoinpool-4071-worker-1] debug asyncmail.asynchronousmailprocessservice - flush session. 2015-06-14 12:04:23,125 [forkjoinpool-4071-worker-1] debug asyncmail.asynchronousmailprocessservice - destroy session.
however, in instances, doesn't send email , there's no open/flush/destroy session in logs.
when @ async_mail_mess
table in database, can see there email entry has error status.
i'm not sure what's causing intermittent error , can't see stacktrace logs. should increase max attempt count? how catch these errors?
the plugin changes message status error before sending message after changes status sent. it's needed prevent double sending in case of system crushed. looks see messages sent right now.
Comments
Post a Comment