Search in sources :

Example 1 with EnhancedSMTPServer

use of org.wildfly.swarm.mail.EnhancedSMTPServer in project wildfly-swarm by wildfly-swarm.

the class SocketBindingCustomizer method customize.

@Override
public void customize() {
    if (!mailInstance.isUnsatisfied()) {
        MailFraction mailFraction = mailInstance.get();
        for (MailSession session : mailFraction.subresources().mailSessions()) {
            SMTPServer server = session.subresources().smtpServer();
            if (server != null && server instanceof EnhancedSMTPServer) {
                if (server.outboundSocketBindingRef() == null) {
                    String ref = "mail-smtp-" + ((EnhancedSMTPServer) server).sessionKey();
                    this.group.outboundSocketBinding(new OutboundSocketBinding(ref).remoteHost(((EnhancedSMTPServer) server).host()).remotePort(((EnhancedSMTPServer) server).port()));
                    ((EnhancedSMTPServer) server).outboundSocketBindingRef(ref);
                }
            }
        }
    }
}
Also used : OutboundSocketBinding(org.wildfly.swarm.spi.api.OutboundSocketBinding) MailFraction(org.wildfly.swarm.mail.MailFraction) EnhancedSMTPServer(org.wildfly.swarm.mail.EnhancedSMTPServer) MailSession(org.wildfly.swarm.config.mail.MailSession) SMTPServer(org.wildfly.swarm.config.mail.mail_session.SMTPServer) EnhancedSMTPServer(org.wildfly.swarm.mail.EnhancedSMTPServer)

Aggregations

MailSession (org.wildfly.swarm.config.mail.MailSession)1 SMTPServer (org.wildfly.swarm.config.mail.mail_session.SMTPServer)1 EnhancedSMTPServer (org.wildfly.swarm.mail.EnhancedSMTPServer)1 MailFraction (org.wildfly.swarm.mail.MailFraction)1 OutboundSocketBinding (org.wildfly.swarm.spi.api.OutboundSocketBinding)1