Class TinyMailServiceImpl
-
- All Implemented Interfaces:
-
org.springframework.beans.factory.InitializingBean,pro.fessional.wings.tiny.mail.service.TinyMailService
@Service()@ConditionalWingsEnabled() public class TinyMailServiceImpl implements TinyMailService, InitializingBean
- Since:
2023-01-06
trydofor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classTinyMailServiceImpl.AsyncMailpublic enumTinyMailServiceImpl.Jane
-
Constructor Summary
Constructors Constructor Description TinyMailServiceImpl()
-
Method Summary
Modifier and Type Method Description booleansend(@NotNull() TinyMail message, boolean retry)Save first, then Sync single send. and return, - true, if send success. - false, if check fail, e.g. prop, lock or format. - throw if send fail, MailRetryException if async retry.longpost(@NotNull() TinyMail message, boolean retry)Save first, then Sync single send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - {@value #Success}, if send success. - mills > now(), estimated retry time, if fail and async retrylongemit(@NotNull() TinyMail message, boolean retry)Save first, then Async batch send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - mills > now(), estimated send or retry (when error) timebooleansend(long id, boolean retry, boolean check)Save first, then Sync single send. and return, - true, if send success. - false, if check fail, e.g. prop, lock or format. - throw if send fail, MailRetryException if async retry.longpost(long id, boolean retry, boolean check)Save first, then Sync single send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - {@value #Success}, if send success. - mills > now(), estimated retry time, if fail and async retrylongemit(long id, boolean retry, boolean check)Save first, then Async batch send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - mills > now(), estimated send or retry (when error) timevoidafterPropertiesSet()voiddestroy()longsave(@NotNull() TinyMailPlain msg, boolean check)Create(id is empty) or edit a mail with check, return the id. intscan(Long idle)Sync scan the unsent mail to resend them async, return the count. and if idel is * null, only scan, nothing to idle * > 0, adjust the scheduled scan interval mills * = 0, disable the scheduled scan * < 0, reset to scan-idle prop if adjusted beforeArrayList<TinyMailServiceImpl.AsyncMail>listAsyncMailQueue()TreeMap<Long, ScheduledFuture<out Object>>listAsyncMailTask()voidsetAppName(String appName)voidsetLightIdService(LightIdService lightIdService)voidsetJournalService(JournalService journalService)voidsetWinMailSenderDao(WinMailSenderDao winMailSenderDao)voidsetMailConfigProvider(MailConfigProvider mailConfigProvider)voidsetMailSenderManager(MailSenderManager mailSenderManager)voidsetTinyMailServiceProp(TinyMailServiceProp tinyMailServiceProp)voidsetResourceLoader(ResourceLoader resourceLoader)voidsetStatusHookProvider(ObjectProvider<TinyMailService.StatusHook> statusHookProvider)voidsetLazyBeanProvider(ObjectProvider<TinyMailLazy> lazyBeanProvider)-
-
Method Detail
-
send
boolean send(@NotNull() TinyMail message, boolean retry)
Save first, then Sync single send. and return, - true, if send success. - false, if check fail, e.g. prop, lock or format. - throw if send fail, MailRetryException if async retry.
-
post
long post(@NotNull() TinyMail message, boolean retry)
Save first, then Sync single send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - {@value #Success}, if send success. - mills > now(), estimated retry time, if fail and async retry
-
emit
long emit(@NotNull() TinyMail message, boolean retry)
Save first, then Async batch send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - mills > now(), estimated send or retry (when error) time
-
send
boolean send(long id, boolean retry, boolean check)
Save first, then Sync single send. and return, - true, if send success. - false, if check fail, e.g. prop, lock or format. - throw if send fail, MailRetryException if async retry.
-
post
long post(long id, boolean retry, boolean check)
Save first, then Sync single send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - {@value #Success}, if send success. - mills > now(), estimated retry time, if fail and async retry
-
emit
long emit(long id, boolean retry, boolean check)
Save first, then Async batch send, fire and forget, no exception throw. and return, - {@value #ErrOther}, if throw non MailRetryException. - {@value #ErrCheck}, if check fail, e.g. prop, lock or format. - mills > now(), estimated send or retry (when error) time
-
afterPropertiesSet
void afterPropertiesSet()
-
destroy
@EventListener(value = ContextClosedEvent.class) void destroy()
-
save
long save(@NotNull() TinyMailPlain msg, boolean check)
Create(id is empty) or edit a mail with check, return the id. NOTE: no schedule to send, need manually send/post/emit it.
-
scan
int scan(Long idle)
Sync scan the unsent mail to resend them async, return the count. and if idel is * null, only scan, nothing to idle * > 0, adjust the scheduled scan interval mills * = 0, disable the scheduled scan * < 0, reset to scan-idle prop if adjusted before
-
listAsyncMailQueue
@NotNull() ArrayList<TinyMailServiceImpl.AsyncMail> listAsyncMailQueue()
-
listAsyncMailTask
@NotNull() TreeMap<Long, ScheduledFuture<out Object>> listAsyncMailTask()
-
setAppName
@Value(value = "${spring.application.name}") void setAppName(String appName)
-
setLightIdService
@Autowired() void setLightIdService(LightIdService lightIdService)
-
setJournalService
@Autowired() void setJournalService(JournalService journalService)
-
setWinMailSenderDao
@Autowired() void setWinMailSenderDao(WinMailSenderDao winMailSenderDao)
-
setMailConfigProvider
@Autowired() void setMailConfigProvider(MailConfigProvider mailConfigProvider)
-
setMailSenderManager
@Autowired() void setMailSenderManager(MailSenderManager mailSenderManager)
-
setTinyMailServiceProp
@Autowired() void setTinyMailServiceProp(TinyMailServiceProp tinyMailServiceProp)
-
setResourceLoader
@Autowired() void setResourceLoader(ResourceLoader resourceLoader)
-
setStatusHookProvider
@Autowired() void setStatusHookProvider(ObjectProvider<TinyMailService.StatusHook> statusHookProvider)
-
setLazyBeanProvider
@Autowired() void setLazyBeanProvider(ObjectProvider<TinyMailLazy> lazyBeanProvider)
-
-
-
-