Skip to content

Bound asynchronous mail submission and expose backpressure #725

Closed

Description

@bbottema

Part of #722, step 2 (phase 2). A busy or stalled SMTP server can leave unlimited prepared emails waiting behind the async workers. Add opt-in per-Mailer queue capacity and explicit immediate-rejection or bounded-wait overflow behavior, independently of worker and connection-pool sizes. Preserve caller-owned executors, lazy simple batches, scheduling-failure observation and resource ownership. Expose content-free queue diagnostics and document the use case, Java API, properties, Spring and CLI configuration. Implement directly on codex/10.0.0; leave changes for review before commit. Historical demand: #656 and #85. The related deadline/cancellation step must not confuse timing out a completion future with stopping SMTP work.

Activity

  1. added this to the 10.0.0 milestone on Sep 8, 2026
  2. self-assigned this
    on Sep 8, 2026
  3. moved this from Todo to In Progress in Simple Java Mail 10.0.0on Sep 8, 2026
  4. bbottema commented on Sep 11, 2026

    @bbottema
    OwnerAuthor

    Implemented for 10.0.0 as part of #722. Queue capacity and overflow handling are opt-in; existing defaults remain unbounded.

    Mailer mailer = mail.mailerBuilder()
        .withAsyncQueueCapacity(100)
        .withAsyncQueueOverflowPolicy(AsyncQueueOverflowPolicy.REJECT)
        .buildMailer();
    
    mailer.sendMailAsync(email).getCompletion()
        .whenComplete((ignored, failure) -> recordResult(failure));

    A full queue reports MailSendRejectedException; use getAsyncQueueSnapshot() for queue activity and rejection counts. Java, properties, Spring and CLI configuration are covered in the Sending and execution guide.

  5. moved this from In Progress to Done in Simple Java Mail 10.0.0on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions