Example usage for io.vertx.core VertxOptions setEventBusOptions

List of usage examples for io.vertx.core VertxOptions setEventBusOptions

Introduction

In this page you can find the example usage for io.vertx.core VertxOptions setEventBusOptions.

Prototype

public VertxOptions setEventBusOptions(EventBusOptions options) 

Source Link

Document

Sets the event bus configuration to configure the host, port, ssl...

Usage

From source file:spring.vertxtest.Application.java

@PostConstruct
public void init() {
    log.info("init() -- Initializing application");

    try {/*  w  w  w. j ava2s .c  o m*/

        String httpPort = System.getProperty("HTTP_PORT", "54322");
        port = Integer.parseInt(httpPort);

        //Verticle port and router config
        verticle.setPort(port);
        Router router = Router.router(Vertx.vertx());
        verticle.setRouter(router);

        //Verticle ssl https config
        JksOptions keyStoreOptions = new JksOptions();
        keyStoreOptions.setPath(sslKeystorePath).setPassword(sslKeystorePassword);

        JksOptions trustStoreOptions = new JksOptions();
        trustStoreOptions.setPath(sslTruststorePath).setPassword(sslTruststorePassword);

        VertxOptions options = new VertxOptions();

        if (sslEnabled) {
            options.setEventBusOptions(new EventBusOptions().setSsl(true).setKeyStoreOptions(keyStoreOptions)
                    .setTrustStoreOptions(trustStoreOptions).setClientAuth(ClientAuth.NONE)
            //.setClientAuth(ClientAuth.REQUIRED)
            );
        }

        verticle.setSslOptions(keyStoreOptions, trustStoreOptions);

        //Launch verticle
        Vertx.vertx(options).deployVerticle(verticle);
    } catch (Exception e) {
        log.error("Exception", e);
    }
}