Search in sources :

Example 1 with RestListener

use of com.codingchili.core.listener.transport.RestListener in project chili-core by codingchili.

the class Service method start.

@Override
public void start(Future<Void> start) {
    List<Future> deployments = new ArrayList<>();
    for (ListenerSettings listener : context.transports()) {
        handler = new RouterHandler(context);
        Future<String> future = Future.future();
        deployments.add(future);
        switch(listener.getType()) {
            case UDP:
                start(UdpListener::new, listener.getType(), future);
                break;
            case TCP:
                start(TcpListener::new, listener.getType(), future);
                break;
            case WEBSOCKET:
                start(WebsocketListener::new, listener.getType(), future);
                break;
            case REST:
                start(RestListener::new, listener.getType(), future);
                break;
        }
    }
    Logger logger = context.logger(getClass());
    all(deployments).setHandler(done -> {
        // logger.onServiceStarted(this);
        start.complete();
    });
}
Also used : RestListener(com.codingchili.core.listener.transport.RestListener) UdpListener(com.codingchili.core.listener.transport.UdpListener) RouterHandler(com.codingchili.router.controller.RouterHandler) ArrayList(java.util.ArrayList) WebsocketListener(com.codingchili.core.listener.transport.WebsocketListener) Future(io.vertx.core.Future) TcpListener(com.codingchili.core.listener.transport.TcpListener) Logger(com.codingchili.core.logging.Logger) ListenerSettings(com.codingchili.core.listener.ListenerSettings)

Aggregations

ListenerSettings (com.codingchili.core.listener.ListenerSettings)1 RestListener (com.codingchili.core.listener.transport.RestListener)1 TcpListener (com.codingchili.core.listener.transport.TcpListener)1 UdpListener (com.codingchili.core.listener.transport.UdpListener)1 WebsocketListener (com.codingchili.core.listener.transport.WebsocketListener)1 Logger (com.codingchili.core.logging.Logger)1 RouterHandler (com.codingchili.router.controller.RouterHandler)1 Future (io.vertx.core.Future)1 ArrayList (java.util.ArrayList)1