{"id":21428048,"url":"https://github.com/redhat-developer-demos/vertx-starter","last_synced_at":"2025-07-29T11:33:11.168Z","repository":{"id":91531567,"uuid":"196197940","full_name":"redhat-developer-demos/vertx-starter","owner":"redhat-developer-demos","description":"A simple Vert.x application","archived":false,"fork":false,"pushed_at":"2019-07-29T19:10:13.000Z","size":30,"stargazers_count":6,"open_issues_count":0,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T11:50:43.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redhat-developer-demos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-10T12:05:20.000Z","updated_at":"2020-05-27T05:40:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3e69ce5-e626-429a-9c1d-f1fc07aefe38","html_url":"https://github.com/redhat-developer-demos/vertx-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/redhat-developer-demos/vertx-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fvertx-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fvertx-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fvertx-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fvertx-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-developer-demos","download_url":"https://codeload.github.com/redhat-developer-demos/vertx-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fvertx-starter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267678448,"owners_count":24126333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T22:10:05.793Z","updated_at":"2025-07-29T11:33:11.163Z","avatar_url":"https://github.com/redhat-developer-demos.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Coderland logo](images/Coderland_logo.png)\n\n# `vertx-starter`\n\n## Overview\n\nThis is a simple application to get you started with the Vert.x toolkit.\nIt is a companion to the tutorial [Reactica: reactive programming and Vert.x](https://developers.redhat.com/coderland/reactive/). \n\nThe code features\ntwo processes running simultaneously. One process (`vertx.setPeriodic()`) \nwrites a message to the\nconsole every two seconds, while the other (`vertx.createHttpServer()`) \nserves requests on HTTP port 8080. \n\n## The code\n\nHere's the heart of the source code: \n\n```Java\n    @Override\n    public void start() {\n        vertx.setPeriodic(2000, counter -\u003e {\n            long runTime = (System.currentTimeMillis() - startTime) / 1000;\n            System.out.println(\"Server run time: \" + runTime + \" seconds.\");\n        });\n\n        vertx.createHttpServer()\n            .requestHandler(req -\u003e {\n                System.out.println(\"Request #\" + counter++ +\n                                   \" from \" + req.remoteAddress().host());\n                req.response().end(\"Hello from Coderland!\");\n            })\n            .listen(8080);\n        \n        System.out.println(\"----------------------------------------------\");\n        System.out.println(\"---\u003e Coderland now listening on localhost:8080\");\n        System.out.println(\"----------------------------------------------\");\n    }\n\n    @Override\n    public void stop() {\n        System.out.println(\"---------------------------------------------\");\n        System.out.println(\"---\u003e Coderland signing off! Have a great day.\");\n        System.out.println(\"---------------------------------------------\");\n    }\n```\n\n## Building and running the code\n\nThe following commands build and run the code: \n\n```\nmvn clean package\njava -jar target/vertx-starter-1.0-SNAPSHOT.jar\n```\n\n## Sample output \n\nSample output looks like this: \n\n```\ndoug@dtidwell-mac:~/vertx-starter $ java -jar target/vertx-starter-1.0-SNAPSHOT.jar \n----------------------------------------------\n---\u003e Coderland now listening on localhost:8080\n----------------------------------------------\nJun 26, 2019 8:33:59 AM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer\nINFO: Succeeded in deploying verticle\nServer run time: 2 seconds.\nServer run time: 4 seconds.\nRequest #1 from 192.168.1.67\nServer run time: 6 seconds.\nRequest #2 from 192.168.1.76\nServer run time: 8 seconds.\nServer run time: 10 seconds.\nRequest #3 from 0:0:0:0:0:0:0:1\nRequest #4 from 0:0:0:0:0:0:0:1\nServer run time: 12 seconds.\nServer run time: 14 seconds.\nServer run time: 16 seconds.\nRequest #5 from 192.168.1.67\nServer run time: 18 seconds.\nServer run time: 20 seconds.\nRequest #6 from 192.168.1.76\nServer run time: 22 seconds.\nServer run time: 24 seconds.\n^C---------------------------------------------\n---\u003e Coderland signing off! Have a great day.\n---------------------------------------------\n```\n\n## Some notes on the output: \n\nFirst of all, notice that we `@Override` the `start()` and `stop()` methods. \nOverriding the `start()` method is typical because you probably want to set \nup some things when your verticle is loaded. Overriding `stop()` is less \ncommon, but notice that typing Ctrl+C at the command line invoked the `stop()` \nmethod before the system killed the code. \n \nSecond, the print statements in the `start()` method were executed before the \nverticle was up and running. The Vert.x runtime doesn’t print the \n“Succeeded in deploying verticle” message until the `start()` method is \nfinished. The output says the code is listening on port 8080, but that’s not\ntechnically true until a fraction of a second later when the verticle is fully loaded. \n \nYou can see the two asynchronous processes the verticle uses. \nOne (`vertx.setPeriodic()`) is invoked every \ntwo seconds, the other (`vertx.createHttpServer()`) is invoked whenever an \nHTTP request comes in on localhost:8080. \nAs long as the verticle is running, these two processes operate \nindependently of each other.\n\n## The Reactica roller coaster\n\nCoderland's tutorial [Reactica: reactive programming and Vert.x](https://developers.redhat.com/coderland/reactive)\nfeatures a complete, sophisticated example of a system \nof reactive Vert.x microservices that work together. \n\n:gift: [REPO: The Reactica roller coaster source code](https://github.com/reactica/rhte-demo)\n\n:page_facing_up: [Reactica roller coaster overview](https://developers.redhat.com/coderland/reactive/)\n\n:clapper: [VIDEO: An overview of the Reactica roller coaster](https://youtu.be/)\n\n:book: Clement Escoffier's excellent book [Building Reactive Microservices in Java](https://developers.redhat.com/books/building-reactive-microservices-java/), available for free from [the Red Hat Developer Program](https://developers.redhat.com/)\n\n:page_facing_up: Andre Staltz's [The introduction to Reactive Programming you've been missing](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754)\n\n:page_facing_up: [The Reactive Manifesto](https://www.reactivemanifesto.org/)\n\n:page_facing_up: [The Vert.x home page](https://vertx.io)\n\n***\n\nCoderland :roller_coaster::rocket::ferris_wheel: is an imaginary theme park for learning, developer training, and Red Hat software. See [the Red Hat Developer Program](https://developers.redhat.com/) for more great stuff.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-developer-demos%2Fvertx-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-developer-demos%2Fvertx-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-developer-demos%2Fvertx-starter/lists"}