Simple example to deploy a server with Konduit-Serving

In this example, we'll deploy a server with Konduit-Serving.

  • First, let's start with creating a complete configuration of the server.

InferenceConfiguration inferenceConfiguration = new InferenceConfiguration();
                .add(new LoggingStep().log(LoggingStep.Log.KEYS_AND_VALUES))
  • Let's deploy the server with the configuration made above. The successful server deployment will give the port number and host of the server:

                new VertxOptions(), // Default vertx options
                new DeploymentOptions(), // Default deployment options
                inferenceConfiguration, // Inference configuration with logging step
                handler -> { // this block will be called when server finishes the deployment
                    if (handler.succeeded()) { // If the server is sucessfully running
                        // Getting the result of the deployment
                        InferenceDeploymentResult inferenceDeploymentResult = handler.result();
                        int runnningPort = inferenceDeploymentResult.getActualPort();
                        String deploymentId = inferenceDeploymentResult.getDeploymentId();

                        System.out.format("The server is running on port %s with deployment id of %s%n",
                                runnningPort, deploymentId);

                        try {
                            String result ="http://localhost:%s/predict", runnningPort))
                                    .header("Content-Type", "application/json")
                                    .header("Accept", "application/json")
                                    .body(new JSONObject().put("input_key", "input_value"))

                            System.out.format("Result from server : %s%n", result);

                        } catch (UnirestException e) {

                    } else { // If the server failed to run

You'll be able to see the output similar to this once the server successfully deployed:

The server is running on port 37663 with deployment id of 59d5d475-be83-4348-8983-4d3e7328e71d
Result from server : {
  "input_key" : "input_value"

Process finished with exit code 0

Last updated