Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email configuration cannot be changed at runtime #1232

Closed
2 tasks done
nscuro opened this issue Apr 24, 2024 · 1 comment · Fixed by #1229
Closed
2 tasks done

Email configuration cannot be changed at runtime #1232

nscuro opened this issue Apr 24, 2024 · 1 comment · Fixed by #1229
Assignees
Labels
defect Something isn't working domain/notifications p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/M Medium effort

Comments

@nscuro
Copy link
Member

nscuro commented Apr 24, 2024

Current Behavior

We currently use the quarkus-mailer extension to send emails in the notification-publisher.

The configuration of Mailer cannot be changed dynamically at runtime. Instead, it is initialized once on startup. https://stackoverflow.com/questions/70090456/how-to-change-mail-config-quarkus-at-runtime

## SMTP Mailer
#
quarkus.mailer.from=""
quarkus.mailer.host=""
quarkus.mailer.port=
quarkus.mailer.start-tls=DISABLED
quarkus.mailer.username="'
quarkus.mailer.password=""
quarkus.mailer.ssl=false

As part of #929, we need to support modifications to the email configuration via UI. This means that the configuration must reload while the application is running.

The Quarkus Mailer uses Vert.x MailClient behind the scenes. We might need to construct MailClient instances at runtime. The Vert.x docs show how it can be done:

MailConfig config = new MailConfig();
config.setHostname("mail.example.com");
config.setPort(587);
config.setStarttls(StartTLSOptions.REQUIRED);
config.setUsername("user");
config.setPassword("password");
MailClient mailClient = MailClient.create(vertx, config);

The docs also mention connection pooling:

The client can use a connection pool of the SMTP connections to get rid of the overhead of connecting each time to the server, negotiating TLS and login (this function can be turned off by setting keepAlive = false). A client can either be shared or non-shared, if it is shared, the same connection pool will be used for all clients using the same identifier.

This means it could be too expensive to construct a new client for every notification. We will need to find a way to cache MailClient instances until the underlying configuration changes.

Steps to Reproduce

N/A

Expected Behavior

The email configuration should be configurable via UI.

Hyades Version

0.5.0-SNAPSHOT

Repository Type

Hyades services

Browser

N/A

Checklist

@nscuro nscuro added defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk domain/notifications size/M Medium effort labels Apr 24, 2024
@nscuro nscuro self-assigned this Apr 24, 2024
@nscuro
Copy link
Member Author

nscuro commented Apr 24, 2024

Working on this as part of #1229

nscuro added a commit that referenced this issue Apr 25, 2024
Note that the `quarkus-mailer` dependency is still required in order to be able to use Vert.x's `MailClient`.

Fixes #1232

Signed-off-by: nscuro <nscuro@protonmail.com>
nscuro added a commit that referenced this issue Apr 30, 2024
Note that the `quarkus-mailer` dependency is still required in order to be able to use Vert.x's `MailClient`.

Fixes #1232

Signed-off-by: nscuro <nscuro@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something isn't working domain/notifications p2 Non-critical bugs, and features that help organizations to identify and reduce risk size/M Medium effort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant