Skip to content

Commit

Permalink
Merge pull request #163 from tsegismont/issue/162
Browse files Browse the repository at this point in the history
Different start method in Get Started guide and starter
  • Loading branch information
michel-kraemer authored Sep 14, 2024
2 parents 0416664 + a729217 commit aac3014
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Binary file modified assets/get-started/starter-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 20 additions & 7 deletions pages/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,18 @@ Change the code as follows:
<CodeExample title="Java">

```java
package com.example.starter;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.MultiMap;
import io.vertx.core.Promise;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.Router;

public class MainVerticle extends AbstractVerticle {

@Override
public void start() throws Exception {
public void start(Promise<Void> startPromise) throws Exception {
// Create a Router
Router router = Router.router(vertx);

Expand All @@ -93,12 +102,16 @@ public class MainVerticle extends AbstractVerticle {
.requestHandler(router)
// Start listening
.listen(8888)
// Print the port
.onSuccess(server ->
System.out.println(
"HTTP server started on port " + server.actualPort()
)
);
// Print the port on success
.onSuccess(server -> {
System.out.println("HTTP server started on port " + server.actualPort());
startPromise.complete();
})
// Print the problem on failure
.onFailure(throwable -> {
throwable.printStackTrace();
startPromise.fail(throwable);
});
}
}
```
Expand Down

0 comments on commit aac3014

Please sign in to comment.