Interface TinyMailService

  • All Implemented Interfaces:

    
    public interface TinyMailService
    
                        

    Send mail sync or async, save to database first to ensure mail must be sent.

    Since:

    2022-12-29

    Author:

    trydofor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public interface TinyMailService.StatusHook

      hook the sending result (success/failure), and can stop the next send. should not throw exception in the hook.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract 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.
      
      abstract 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
      
      abstract 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
      
      boolean send(@NotNull() TinyMailPlain message)
      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.
      
      long post(@NotNull() TinyMailPlain message)
      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
      
      long emit(@NotNull() TinyMailPlain message)
      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
      
      abstract 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.
      
      abstract 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
      
      abstract 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
      
      long save(@NotNull() TinyMailPlain message) Create(id is empty) or edit a mail with check, return the id.
      abstract long save(@NotNull() TinyMailPlain message, boolean check) Create(id is empty) or edit a mail with check, return the id.
      abstract 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
      
      int scan() Sync scan the unsent mail to resend them async, return the count.
      long auto(@NotNull() TinyMail message, boolean retry)
      Save first, then auto post/emit by its mail-date. and retrun,
      - {@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
      
      long auto(@NotNull() TinyMailPlain message)
      Save first, then auto post/emit by its mail-date. and retrun,
      - {@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
      
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • send

         abstract 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

         abstract 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

         abstract 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(@NotNull() TinyMailPlain message)
        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() TinyMailPlain message)
        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() TinyMailPlain message)
        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

         abstract 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

         abstract 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

         abstract 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
        
      • save

         long save(@NotNull() TinyMailPlain message)

        Create(id is empty) or edit a mail with check, return the id. NOTE: no schedule to send, need manually send/post/emit it.

      • save

         abstract long save(@NotNull() TinyMailPlain message, 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

         abstract 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
        
      • scan

         int scan()

        Sync scan the unsent mail to resend them async, return the count.

      • auto

         long auto(@NotNull() TinyMail message, boolean retry)
        Save first, then auto post/emit by its mail-date. and retrun,
        - {@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
        
      • auto

         long auto(@NotNull() TinyMailPlain message)
        Save first, then auto post/emit by its mail-date. and retrun,
        - {@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