Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
37477 amit 1
package com.spice.profitmandi.common.mail;
2
 
3
/**
4
 * The single way to send mail in this system.
5
 *
6
 * Nothing sends inline. A caller hands over a {@link MailRequest} and returns;
7
 * delivery, retry and de-duplication happen afterwards, driven by the outbox.
8
 * That matters because SMTP fails often and for boring reasons — an expired
9
 * credential, a timeout on a large attachment, a provider refusing an
10
 * unauthorised sender — and an inline send loses the message when it does. It is
11
 * also why a report job should not be marked FAILED merely because the mail it
12
 * generated could not be handed over at that instant.
13
 *
14
 * The interface lives in profitmandi-common while the implementation lives in
15
 * profitmandi-dao, because dao depends on common and not the other way round.
16
 * Utils and EmailService are in common and could not otherwise reach the outbox
17
 * at all.
18
 */
19
public interface MailQueue {
20
 
21
    /**
22
     * Accepts a mail for delivery. Returns once the request is durably recorded,
23
     * not once it is sent. Implementations must not throw for delivery problems —
24
     * a caller has no useful response to "SMTP is down".
25
     */
26
    void queue(MailRequest request);
27
}