Package io.micronaut.email.sendgrid
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 Summary
-
Constructor Summary
ConstructorDescriptionSendgridEmailSender
(SendGridConfiguration sendGridConfiguration, SendgridEmailComposer sendgridEmailComposer) -
Method Summary
Modifier and TypeMethodDescription@NonNull String
getName()
@NonNull com.sendgrid.Response
send
(@NonNull @NotNull @Valid Email email, @NonNull @NotNull Consumer<com.sendgrid.Request> emailRequest) Sends an email.@NonNull org.reactivestreams.Publisher<com.sendgrid.Response>
sendAsync
(@NonNull @NotNull @Valid Email email, @NonNull @NotNull Consumer<com.sendgrid.Request> emailRequest) Sends an email.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.email.AsyncTransactionalEmailSender
sendAsync
Methods inherited from interface io.micronaut.email.TransactionalEmailSender
send
-
Field Details
-
NAME
SendgridEmailSender
name.- See Also:
-
-
Constructor Details
-
SendgridEmailSender
public SendgridEmailSender(SendGridConfiguration sendGridConfiguration, SendgridEmailComposer sendgridEmailComposer) - Parameters:
sendGridConfiguration
- SendGrid ConfigurationsendgridEmailComposer
- SendGrid Email composer
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceio.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 interfaceTransactionalEmailSender<com.sendgrid.Request,
com.sendgrid.Response> - Parameters:
email
- EmailemailRequest
- 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 interfaceAsyncTransactionalEmailSender<com.sendgrid.Request,
com.sendgrid.Response> - Parameters:
email
- EmailemailRequest
- Email Request Consumer- Returns:
- Response Object or empty optional if an error occurred
- Throws:
EmailException
- Wrapper of any exception thrown while sending email
-