- Asynchronous event based pipe handling
- piveau conformable logging
- Internal management of pipe structure
- Convenient API
- Vert.x support
The most simple example would be:
PipeConnector.create().handle(pipeContext -> pipeContext.setResult("Hello World!"));
Of course, a more practical example would be this:
PipeConnector connector = PipeConnector.create();
connector.handle(pipeContext -> {
JsonNode config = pipeContext.getConfig();
String data = pipeContext.getStringData();
// do your job here
String result = ...
pipeContext.setResult(result);
});
If you're already in a Vert.x context and would like to use a worker Verticle with an event bus address, this will do:
PipeConnector.create(vertx, ar -> {
if (ar.succeeded()) {
ar.result().consumerAddress(EVENTBUS_ADDRESS);
startFuture.complete();
} else {
startFuture.fail(ar.cause());
}
});
-
/pipe
Pipe endpoint (see ReDoc on root context path)
-
/health
Returns up status and build infos. Requires a buildInfo.json in the classpath, e.g.:
{ "timestamp": "${buildTimestamp}", "version": "${project.version}" }
timestamp
andversion
could be set automatically by maven. -
/metrics
Internal metric infos
It is possible to mount a sub-router for your own interfaces:
connector.subRouter("/mountPoint", router);
-
PIVEAU_PIPE_ENDPOINT_PORT - Default port is 8080
-
PIVEAU_PIPE_MAIL_CONFIG - JSON object:
{ "host": "<smtp_host>", "system": "<environment>", "mailto": "<receiver_address>" }