Class SendgridEmailSender

java.lang.Object
io.micronaut.email.sendgrid.SendgridEmailSender
All Implemented Interfaces:
io.micronaut.core.naming.Named, AsyncTransactionalEmailSender<com.sendgrid.Request,com.sendgrid.Response>, TransactionalEmailSender<com.sendgrid.Request,com.sendgrid.Response>

@Requires(beans={SendGridConfiguration.class,SendgridEmailComposer.class}) @Named("sendgrid") @Singleton public class SendgridEmailSender extends Object implements TransactionalEmailSender<com.sendgrid.Request,com.sendgrid.Response>, AsyncTransactionalEmailSender<com.sendgrid.Request,com.sendgrid.Response>
Since:
1.0.0
Author:
Sergio del Amo
  • Field Details

  • Constructor Details

    • SendgridEmailSender

      public SendgridEmailSender(SendGridConfiguration sendGridConfiguration, SendgridEmailComposer sendgridEmailComposer)
      Parameters:
      sendGridConfiguration - SendGrid Configuration
      sendgridEmailComposer - SendGrid Email composer
  • Method Details

    • getName

      @NonNull public @NonNull String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • send

      @NonNull public @NonNull com.sendgrid.Response send(@NonNull @NotNull @Valid @NonNull @NotNull @Valid Email email, @NonNull @NotNull @NonNull @NotNull Consumer<com.sendgrid.Request> emailRequest) throws EmailException
      Description copied from interface: TransactionalEmailSender
      Sends an email.
      Specified by:
      send in interface TransactionalEmailSender<com.sendgrid.Request,com.sendgrid.Response>
      Parameters:
      email - Email
      emailRequest - Email Request Consumer
      Returns:
      Response Object or empty optional if an error occurred
      Throws:
      EmailException - Wrapper of any exception thrown while sending email
    • sendAsync

      @NonNull public @NonNull org.reactivestreams.Publisher<com.sendgrid.Response> sendAsync(@NonNull @NotNull @Valid @NonNull @NotNull @Valid Email email, @NonNull @NotNull @NonNull @NotNull Consumer<com.sendgrid.Request> emailRequest) throws EmailException
      Description copied from interface: AsyncTransactionalEmailSender
      Sends an email.
      Specified by:
      sendAsync in interface AsyncTransactionalEmailSender<com.sendgrid.Request,com.sendgrid.Response>
      Parameters:
      email - Email
      emailRequest - Email Request Consumer
      Returns:
      Response Object or empty optional if an error occurred
      Throws:
      EmailException - Wrapper of any exception thrown while sending email