public void start()

in docker_images/java/wrapper/src/main/java/io/swagger/server/api/verticle/ServiceApiVerticle.java [41:210]


    public void start() throws Exception {

        //Consumer for Service_Connect
        vertx.eventBus().<JsonObject> consumer(SERVICE_CONNECT_SERVICE_ID).handler(message -> {
            try {
                // Workaround for #allParams section clearing the vendorExtensions map
                String serviceId = "Service_Connect";
                String connectionStringParam = message.body().getString("connectionString");
                if(connectionStringParam == null) {
                    manageError(message, new MainApiException(400, "connectionString is required"), serviceId);
                    return;
                }
                String connectionString = connectionStringParam;
                service.serviceConnect(connectionString, result -> {
                    if (result.succeeded())
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
                    else {
                        Throwable cause = result.cause();
                        manageError(message, cause, "Service_Connect");
                    }
                });
            } catch (Exception e) {
                logUnexpectedError("Service_Connect", e);
                message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
            }
        });

        //Consumer for Service_Disconnect
        vertx.eventBus().<JsonObject> consumer(SERVICE_DISCONNECT_SERVICE_ID).handler(message -> {
            try {
                // Workaround for #allParams section clearing the vendorExtensions map
                String serviceId = "Service_Disconnect";
                String connectionIdParam = message.body().getString("connectionId");
                if(connectionIdParam == null) {
                    manageError(message, new MainApiException(400, "connectionId is required"), serviceId);
                    return;
                }
                String connectionId = connectionIdParam;
                service.serviceDisconnect(connectionId, result -> {
                    if (result.succeeded())
                        message.reply(null);
                    else {
                        Throwable cause = result.cause();
                        manageError(message, cause, "Service_Disconnect");
                    }
                });
            } catch (Exception e) {
                logUnexpectedError("Service_Disconnect", e);
                message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
            }
        });

        //Consumer for Service_InvokeDeviceMethod
        vertx.eventBus().<JsonObject> consumer(SERVICE_INVOKEDEVICEMETHOD_SERVICE_ID).handler(message -> {
            try {
                // Workaround for #allParams section clearing the vendorExtensions map
                String serviceId = "Service_InvokeDeviceMethod";
                String connectionIdParam = message.body().getString("connectionId");
                if(connectionIdParam == null) {
                    manageError(message, new MainApiException(400, "connectionId is required"), serviceId);
                    return;
                }
                String connectionId = connectionIdParam;
                String deviceIdParam = message.body().getString("deviceId");
                if(deviceIdParam == null) {
                    manageError(message, new MainApiException(400, "deviceId is required"), serviceId);
                    return;
                }
                String deviceId = deviceIdParam;
                JsonObject methodInvokeParametersParam = message.body().getJsonObject("methodInvokeParameters");
                if (methodInvokeParametersParam == null) {
                    manageError(message, new MainApiException(400, "methodInvokeParameters is required"), serviceId);
                    return;
                }
                MethodInvoke methodInvokeParameters = Json.mapper.readValue(methodInvokeParametersParam.encode(), MethodInvoke.class);
                service.serviceInvokeDeviceMethod(connectionId, deviceId, methodInvokeParameters, result -> {
                    if (result.succeeded())
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
                    else {
                        Throwable cause = result.cause();
                        manageError(message, cause, "Service_InvokeDeviceMethod");
                    }
                });
            } catch (Exception e) {
                logUnexpectedError("Service_InvokeDeviceMethod", e);
                message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
            }
        });

        //Consumer for Service_InvokeModuleMethod
        vertx.eventBus().<JsonObject> consumer(SERVICE_INVOKEMODULEMETHOD_SERVICE_ID).handler(message -> {
            try {
                // Workaround for #allParams section clearing the vendorExtensions map
                String serviceId = "Service_InvokeModuleMethod";
                String connectionIdParam = message.body().getString("connectionId");
                if(connectionIdParam == null) {
                    manageError(message, new MainApiException(400, "connectionId is required"), serviceId);
                    return;
                }
                String connectionId = connectionIdParam;
                String deviceIdParam = message.body().getString("deviceId");
                if(deviceIdParam == null) {
                    manageError(message, new MainApiException(400, "deviceId is required"), serviceId);
                    return;
                }
                String deviceId = deviceIdParam;
                String moduleIdParam = message.body().getString("moduleId");
                if(moduleIdParam == null) {
                    manageError(message, new MainApiException(400, "moduleId is required"), serviceId);
                    return;
                }
                String moduleId = moduleIdParam;
                JsonObject methodInvokeParametersParam = message.body().getJsonObject("methodInvokeParameters");
                if (methodInvokeParametersParam == null) {
                    manageError(message, new MainApiException(400, "methodInvokeParameters is required"), serviceId);
                    return;
                }
                MethodInvoke methodInvokeParameters = Json.mapper.readValue(methodInvokeParametersParam.encode(), MethodInvoke.class);
                service.serviceInvokeModuleMethod(connectionId, deviceId, moduleId, methodInvokeParameters, result -> {
                    if (result.succeeded())
                        message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
                    else {
                        Throwable cause = result.cause();
                        manageError(message, cause, "Service_InvokeModuleMethod");
                    }
                });
            } catch (Exception e) {
                logUnexpectedError("Service_InvokeModuleMethod", e);
                message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
            }
        });

        //Consumer for Service_SendC2d
        vertx.eventBus().<JsonObject> consumer(SERVICE_SENDC2D_SERVICE_ID).handler(message -> {
            try {
                // Workaround for #allParams section clearing the vendorExtensions map
                String serviceId = "Service_SendC2d";
                String connectionIdParam = message.body().getString("connectionId");
                if(connectionIdParam == null) {
                    manageError(message, new MainApiException(400, "connectionId is required"), serviceId);
                    return;
                }
                String connectionId = connectionIdParam;
                String deviceIdParam = message.body().getString("deviceId");
                if(deviceIdParam == null) {
                    manageError(message, new MainApiException(400, "deviceId is required"), serviceId);
                    return;
                }
                String deviceId = deviceIdParam;
                JsonObject eventBodyParam = message.body().getJsonObject("eventBody");
                if (eventBodyParam == null) {
                    manageError(message, new MainApiException(400, "eventBody is required"), serviceId);
                    return;
                }
                EventBody eventBody = Json.mapper.readValue(eventBodyParam.encode(), EventBody.class);
                service.serviceSendC2d(connectionId, deviceId, eventBody, result -> {
                    if (result.succeeded())
                        message.reply(null);
                    else {
                        Throwable cause = result.cause();
                        manageError(message, cause, "Service_SendC2d");
                    }
                });
            } catch (Exception e) {
                logUnexpectedError("Service_SendC2d", e);
                message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
            }
        });

    }