<commit_before># vert.x - Reactive Microservices on the JVM
    Reactive Systems are responsive, elastic, message-driven(async, only in-memory), resilient
    The Idea is from NodeJS :-) , but partly better (often can use more-than-one core!)
    Interaction uses vertx.EventBus works within or across JVMs
    web: http://vertx.io/
    Is polyglot: java, js, groovy, ruby... (everything running on the JVM)
    Is Event-Driven, has Event-Loop(using only one thread) like NodeJS
    Management and Monitoring built-in (eg. JMX)

## most basic Example:
#### in Java
```java
import io.vertx.core.Vertx;
import io.vertx.ext.web.Route;
public class My extends io.vertx.core.AbstractVerticle {
    @Override
    public void start() throws Exception {
        vertx.createHttpserver().requestHandler(req -> req.response().end("hi")).listen(8888);
    }
}
```
#### in JS (running on Nashorn (->JVM))
```js
vertx.createHttpServer().requestHandler(function (req) {
    rq.response.end("hi");
}).listen(8888);
```

### Build & Run
```sh
# mvn plugin generates a default vertx app
mvn io.fabric8:vertx-maven-plugin:1.0.5:setup
    -DprojectGroupId=io.vertx.microservice
    -DprojectArtifactId=my
    -Dverticle.io=my.My
    -Ddependencies=web
mvn compile vertx:run

# Alternative: vertx CLI can run from java/js/... source!
vertx run My.java
vertx run My.js -cluster
```

## Example 2:
```java
public class My extends AbstractVerticle {
    @Override
    public void start() throws Exception {
        Router r = Router.router(vertx);
        //GET: use .end because we dont stream
        router.get("/api/a:param").handler(ctx -> ctx.response().end(myLongRunningFunc()));
        //GET: if you block, you have to do that explicitely<commit_msg>cheatsheets<commit_after># vert.x - Reactive Microservices on the JVM
    Reactive Systems are responsive, elastic, message-driven(async, only in-memory), resilient
    The Idea is from NodeJS :-) , but partly better (often can use more-than-one core!)
    Interaction uses vertx.EventBus works within or across JVMs
    web: http://vertx.io/
    Is polyglot: java, js, groovy, ruby... (everything running on the JVM)
    Is Event-Driven, has Event-Loop(using only one thread) like NodeJS
    Management and Monitoring built-in (eg. JMX)

## most basic Example:
#### in Java
```java
import io.vertx.core.Vertx;
import io.vertx.ext.web.Route;
public class My extends io.vertx.core.AbstractVerticle {
    @Override
    public void start() throws Exception {
        vertx.createHttpserver().requestHandler(req -> req.response().end("hi")).listen(8888);
    }
}
```
#### in JS (running on Nashorn (->JVM))
```js
vertx.createHttpServer().requestHandler(function (req) {
    rq.response.end("hi");
}).listen(8888);
```

### Build & Run
```sh
# mvn plugin generates a default vertx app
mvn io.fabric8:vertx-maven-plugin:1.0.5:setup
    -DprojectGroupId=io.vertx.microservice
    -DprojectArtifactId=my
    -Dverticle.io=my.My
    -Ddependencies=web
mvn compile vertx:run -Dvertx.runArgs="-cluster -Djava.net.preferIPv4Stack=true"

# Alternative: vertx CLI can run from java/js/... source!
vertx run My.java
vertx run My.js -cluster -Djava.net.preferIPv4Stack=true
# Alternative: plain java cli call:
java -jar target/my-1.0-SNAPSHOT.jar --cluster -Djava.net.preferIPv4Stack=true
```

## Example 2:
```java
public class My extends AbstractVerticle {
    @Override
    public void start() throws Exception {
        Router r = Router.router(vertx);
        //GET: use .end because we dont stream
        router.get("/api/a:param").handler(ctx -> ctx.response().end(myLongRunningFunc()));
        //GET: if you block, you have to do that explicitely
{'fraction_non_alphanumeric': 0.1308487486398259, 'fraction_numerical': 0.008433079434167573, 'mean_word_length': 3.6368221941992434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5800475', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1169, 'n_words': 350}