Search in sources :

Example 1 with ProtonServerOptions

use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.

the class AmqpServiceBase method createInsecureServerOptions.

/**
 * Invoked during start up to create options for the proton server instance binding to the insecure port.
 * <p>
 * Subclasses may override this method to set custom options.
 *
 * @return The options.
 */
protected ProtonServerOptions createInsecureServerOptions() {
    ProtonServerOptions options = new ProtonServerOptions();
    // // close idle connections after two minutes of inactivity
    options.setHeartbeat(60000);
    // 16kb
    options.setReceiveBufferSize(16 * 1024);
    // 16kb
    options.setSendBufferSize(16 * 1024);
    options.setLogActivity(getConfig().isNetworkDebugLoggingEnabled());
    return options;
}
Also used : ProtonServerOptions(io.vertx.proton.ProtonServerOptions)

Example 2 with ProtonServerOptions

use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.

the class AmqpServiceBase method createServerOptions.

/**
 * Invoked during start up to create options for the proton server instance binding to the secure port.
 * <p>
 * Subclasses may override this method to set custom options.
 *
 * @return The options.
 */
protected ProtonServerOptions createServerOptions() {
    ProtonServerOptions options = createInsecureServerOptions();
    addTlsKeyCertOptions(options);
    addTlsTrustOptions(options);
    return options;
}
Also used : ProtonServerOptions(io.vertx.proton.ProtonServerOptions)

Example 3 with ProtonServerOptions

use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.

the class AmqpServiceBase method startSecureServer.

private Future<Void> startSecureServer() {
    if (isSecurePortEnabled()) {
        int securePort = determineSecurePort();
        final Future<Void> result = Future.future();
        final ProtonServerOptions options = createServerOptions();
        server = createProtonServer(options).connectHandler(this::onRemoteConnectionOpen).listen(securePort, getConfig().getBindAddress(), bindAttempt -> {
            if (bindAttempt.succeeded()) {
                if (getPort() == getPortDefaultValue()) {
                    LOG.info("server listens on standard secure port [{}:{}]", getBindAddress(), getPort());
                } else {
                    LOG.warn("server listens on non-standard secure port [{}:{}], default is {}", getBindAddress(), getPort(), getPortDefaultValue());
                }
                result.complete();
            } else {
                LOG.error("cannot bind to secure port", bindAttempt.cause());
                result.fail(bindAttempt.cause());
            }
        });
        return result;
    } else {
        LOG.info("secure port is not enabled");
        return Future.succeededFuture();
    }
}
Also used : ProtonConnection(io.vertx.proton.ProtonConnection) ProtonReceiver(io.vertx.proton.ProtonReceiver) ProtonServerOptions(io.vertx.proton.ProtonServerOptions) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) HonoUser(org.eclipse.hono.auth.HonoUser) ServiceConfigProperties(org.eclipse.hono.config.ServiceConfigProperties) Constants(org.eclipse.hono.util.Constants) ProtonServer(io.vertx.proton.ProtonServer) ArrayList(java.util.ArrayList) CompositeFuture(io.vertx.core.CompositeFuture) ProtonSession(io.vertx.proton.ProtonSession) HealthCheckHandler(io.vertx.ext.healthchecks.HealthCheckHandler) Duration(java.time.Duration) Map(java.util.Map) Qualifier(org.springframework.beans.factory.annotation.Qualifier) ResourceIdentifier(org.eclipse.hono.util.ResourceIdentifier) AmqpError(org.apache.qpid.proton.amqp.transport.AmqpError) AsyncResult(io.vertx.core.AsyncResult) WeakReference(java.lang.ref.WeakReference) ProtonSaslAuthenticatorFactory(io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory) ProtonHelper(io.vertx.proton.ProtonHelper) UUID(java.util.UUID) Instant(java.time.Instant) Activity(org.eclipse.hono.auth.Activity) Future(io.vertx.core.Future) Objects(java.util.Objects) List(java.util.List) Source(org.apache.qpid.proton.amqp.transport.Source) AbstractServiceBase(org.eclipse.hono.service.AbstractServiceBase) ProtonSender(io.vertx.proton.ProtonSender) ClaimsBasedAuthorizationService(org.eclipse.hono.service.auth.ClaimsBasedAuthorizationService) ProtonLink(io.vertx.proton.ProtonLink) AuthorizationService(org.eclipse.hono.service.auth.AuthorizationService) ProtonServerOptions(io.vertx.proton.ProtonServerOptions)

Example 4 with ProtonServerOptions

use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.

the class AmqpServiceBase method startInsecureServer.

private Future<Void> startInsecureServer() {
    if (isInsecurePortEnabled()) {
        int insecurePort = determineInsecurePort();
        final Future<Void> result = Future.future();
        final ProtonServerOptions options = createInsecureServerOptions();
        insecureServer = createProtonServer(options).connectHandler(this::onRemoteConnectionOpenInsecurePort).listen(insecurePort, getConfig().getInsecurePortBindAddress(), bindAttempt -> {
            if (bindAttempt.succeeded()) {
                if (getInsecurePort() == getInsecurePortDefaultValue()) {
                    LOG.info("server listens on standard insecure port [{}:{}]", getInsecurePortBindAddress(), getInsecurePort());
                } else {
                    LOG.warn("server listens on non-standard insecure port [{}:{}], default is {}", getInsecurePortBindAddress(), getInsecurePort(), getInsecurePortDefaultValue());
                }
                result.complete();
            } else {
                LOG.error("cannot bind to insecure port", bindAttempt.cause());
                result.fail(bindAttempt.cause());
            }
        });
        return result;
    } else {
        LOG.info("insecure port is not enabled");
        return Future.succeededFuture();
    }
}
Also used : ProtonConnection(io.vertx.proton.ProtonConnection) ProtonReceiver(io.vertx.proton.ProtonReceiver) ProtonServerOptions(io.vertx.proton.ProtonServerOptions) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) HonoUser(org.eclipse.hono.auth.HonoUser) ServiceConfigProperties(org.eclipse.hono.config.ServiceConfigProperties) Constants(org.eclipse.hono.util.Constants) ProtonServer(io.vertx.proton.ProtonServer) ArrayList(java.util.ArrayList) CompositeFuture(io.vertx.core.CompositeFuture) ProtonSession(io.vertx.proton.ProtonSession) HealthCheckHandler(io.vertx.ext.healthchecks.HealthCheckHandler) Duration(java.time.Duration) Map(java.util.Map) Qualifier(org.springframework.beans.factory.annotation.Qualifier) ResourceIdentifier(org.eclipse.hono.util.ResourceIdentifier) AmqpError(org.apache.qpid.proton.amqp.transport.AmqpError) AsyncResult(io.vertx.core.AsyncResult) WeakReference(java.lang.ref.WeakReference) ProtonSaslAuthenticatorFactory(io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory) ProtonHelper(io.vertx.proton.ProtonHelper) UUID(java.util.UUID) Instant(java.time.Instant) Activity(org.eclipse.hono.auth.Activity) Future(io.vertx.core.Future) Objects(java.util.Objects) List(java.util.List) Source(org.apache.qpid.proton.amqp.transport.Source) AbstractServiceBase(org.eclipse.hono.service.AbstractServiceBase) ProtonSender(io.vertx.proton.ProtonSender) ClaimsBasedAuthorizationService(org.eclipse.hono.service.auth.ClaimsBasedAuthorizationService) ProtonLink(io.vertx.proton.ProtonLink) AuthorizationService(org.eclipse.hono.service.auth.AuthorizationService) ProtonServerOptions(io.vertx.proton.ProtonServerOptions)

Aggregations

ProtonServerOptions (io.vertx.proton.ProtonServerOptions)4 AsyncResult (io.vertx.core.AsyncResult)2 CompositeFuture (io.vertx.core.CompositeFuture)2 Future (io.vertx.core.Future)2 HealthCheckHandler (io.vertx.ext.healthchecks.HealthCheckHandler)2 ProtonConnection (io.vertx.proton.ProtonConnection)2 ProtonHelper (io.vertx.proton.ProtonHelper)2 ProtonLink (io.vertx.proton.ProtonLink)2 ProtonReceiver (io.vertx.proton.ProtonReceiver)2 ProtonSender (io.vertx.proton.ProtonSender)2 ProtonServer (io.vertx.proton.ProtonServer)2 ProtonSession (io.vertx.proton.ProtonSession)2 ProtonSaslAuthenticatorFactory (io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory)2 WeakReference (java.lang.ref.WeakReference)2 Duration (java.time.Duration)2 Instant (java.time.Instant)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2