Open yazalulloa opened 2 years ago
Should the MailVerticle
be un-deployed before deploying them again on config changes?
On the mail client closing, the internal pool with the shared clients gets closed when there is no reference from MailClient instances to it.
The mail client lacks good way to close because the closing actually takes time like sending QUIT for some existing connections in pool, so I made a branch at: https://github.com/gaol/vertx-mail-client/tree/async_mailclient_close to add this support. then mailClient.close();
in your code can be changed to mailClient.close(promise);
@yazalulloa would you please give the branch a try to see if it works for you? thanks :)
I have no idea how to test a branch, If I download the code I get a bunch of dependency errors
you should use the sonatype oss snapshot repository @yazalulloa
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<layout>default</layout>
<releases>
<enabled>false</enabled>
</releases>
</repository>
How do I set the dependency?
I tried this:
<dependency>
<groupId>gaol</groupId>
<artifactId>vertx-mail-client</artifactId>
<version>async_mailclient_close</version>
</dependency>
But did not work
I'm trying to redeploy a Verticle with Mail Client, trying to change the configuration of the client without restarting the application.
I'm getting this error:
java.lang.IllegalStateException: Client is closed at io.vertx.core.net.impl.NetClientImpl.checkClosed(NetClientImpl.java:176) at io.vertx.core.net.impl.NetClientImpl.connectInternal(NetClientImpl.java:220) at io.vertx.core.net.impl.NetClientImpl.connect(NetClientImpl.java:207) at io.vertx.core.net.impl.NetClientImpl.connect(NetClientImpl.java:122) at io.vertx.core.net.impl.NetClientImpl.connect(NetClientImpl.java:117) at io.vertx.core.net.impl.NetClientImpl.connect(NetClientImpl.java:107) at io.vertx.core.net.impl.NetClientImpl.connect(NetClientImpl.java:102) at io.vertx.ext.mail.impl.SMTPEndPoint.connect(SMTPEndPoint.java:70) at io.vertx.core.net.impl.pool.SimpleConnectionPool.connect(SimpleConnectionPool.java:263) at io.vertx.core.net.impl.pool.SimpleConnectionPool$Acquire$3.run(SimpleConnectionPool.java:591) at io.vertx.core.net.impl.pool.CombinerExecutor.submit(CombinerExecutor.java:50) at io.vertx.core.net.impl.pool.SimpleConnectionPool.execute(SimpleConnectionPool.java:254) at io.vertx.core.net.impl.pool.SimpleConnectionPool.acquire(SimpleConnectionPool.java:634) at io.vertx.core.net.impl.pool.SimpleConnectionPool.acquire(SimpleConnectionPool.java:638) at io.vertx.ext.mail.impl.SMTPEndPoint.requestConnection(SMTPEndPoint.java:61) at io.vertx.core.net.impl.pool.Endpoint.getConnection(Endpoint.java:41) at io.vertx.ext.mail.impl.SMTPConnectionPool.getConnection0(SMTPConnectionPool.java:155) at io.vertx.ext.mail.impl.SMTPConnectionPool.getConnection(SMTPConnectionPool.java:102) at io.vertx.ext.mail.impl.MailClientImpl.getConnection(MailClientImpl.java:119) at io.vertx.ext.mail.impl.MailClientImpl.lambda$sendMail$2(MailClientImpl.java:103) at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141) at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:832)
This is the code:
this is mail_config.yaml:
I'm using version 4.1.5
What would be the correct way to close a shared MailClient and open a new one?
I tried with creating an individual client (not shared), and works perfectly