Vertx Utilities

Library of utility classes and functions for use with Vert.x

License

License

GroupId

GroupId

com.groupon.vertx
ArtifactId

ArtifactId

vertx-utils
Last Version

Last Version

3.5.2
Release Date

Release Date

Type

Type

jar
Description

Description

Vertx Utilities
Library of utility classes and functions for use with Vert.x
Project URL

Project URL

https://github.com/groupon/vertx-utils
Source Code Management

Source Code Management

https://github.com/groupon/vertx-utils

Download vertx-utils

How to add to project

<!-- https://jarcasting.com/artifacts/com.groupon.vertx/vertx-utils/ -->
<dependency>
    <groupId>com.groupon.vertx</groupId>
    <artifactId>vertx-utils</artifactId>
    <version>3.5.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.groupon.vertx/vertx-utils/
implementation 'com.groupon.vertx:vertx-utils:3.5.2'
// https://jarcasting.com/artifacts/com.groupon.vertx/vertx-utils/
implementation ("com.groupon.vertx:vertx-utils:3.5.2")
'com.groupon.vertx:vertx-utils:jar:3.5.2'
<dependency org="com.groupon.vertx" name="vertx-utils" rev="3.5.2">
  <artifact name="vertx-utils" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.groupon.vertx', module='vertx-utils', version='3.5.2')
)
libraryDependencies += "com.groupon.vertx" % "vertx-utils" % "3.5.2"
[com.groupon.vertx/vertx-utils "3.5.2"]

Dependencies

compile (5)

Group / Artifact Type Version
io.vertx : vertx-core jar 3.9.4
io.vertx : vertx-codegen jar 3.9.4
io.netty : netty-codec-http jar 4.1.49.Final
com.arpnetworking.logback : logback-steno jar 1.18.0
com.google.code.findbugs : findbugs-annotations jar 3.0.1

provided (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.25

test (4)

Group / Artifact Type Version
org.mockito : mockito-core jar 2.23.0
org.mockito : mockito-junit-jupiter jar 2.23.0
org.junit.jupiter : junit-jupiter-api jar 5.3.0
org.junit.jupiter : junit-jupiter-engine jar 5.3.0

Project Modules

There are no modules declared in this project.

vert.x-utils

License: Apache 2 Travis Build Maven Artifact Javadocs

A collection of utilities for Vert.x which allow for simplified deployment, standardized logging, rescheduling of handlers, and a file based health check handler.

Usage

RescheduleHandler

Provides the ability to execute a handler on a timer and reschedule on completion.

RescheduleHandler rescheduleHandler = new RescheduleHandler(vertx, event -> { }, 1000);
vertx.setTimer(1000, rescheduleHandler);

MainVerticle

Used to deploy a configurable number of instances of different verticles and enforce dependencies between the verticles. The number of instances may be specified as a multiple per core by suffixing the value with "C" (e.g. "instances":"2C" is two instances per core).

The configuration also allows you to optionally register one or more MessageCodec implementations by specifying an array of fully qualified class names. Each MessageCodec class is required to have a no-args public constructor.

Example mainConf.json:

{
  "verticles": {
    "MetricsVerticle": {
      "class": "com.groupon.vertx.utils.MetricsVerticle",
      "instances": 1,
      "worker": true,
      "config": { }
    },
    "ExampleVerticle": {
      "class": "com.groupon.example.verticle.ExampleVerticle",
      "instances": 1,
      "worker": true,
      "config": { },
      "dependencies": [ "MetricsVerticle" ]
    }
  },
  "messageCodecs": [
    "com.groupon.example.vertx.MyMessageCodec"
  ]
}

Example mod.json:

{
  "main": "com.groupon.vertx.utils.MainVerticle",
  "preserve-cwd": true,
  "worker": false
}

Starting Vert.x with MainVerticle

java -cp conf:lib/* org.vertx.java.platform.impl.cli.Starter runmod com.groupon.example~release -instances 1 -conf conf/mainConf.json

Logger

A wrapper to provide standardized logging calls using slf4j and the com.arpnetworking.logback.StenoMarker

Logger log = Logger.getLogger(Example.class);
log.info("sampleMethod", "Hello logging world!");

Configuration

In the MainVerticle's configuration each child verticle's config key is either an inline JSON object or a String representing a file path. If you specify a file path you may also specify a custom parser with the system property vertx-utils.config-parser-class-name (e.g. -Dvertx-utils.config-parser-class-name=com.example.MyParser). This parser receives the file contents and is required to return a Vert.x JsonObject. Use it to translate your preferred configuration (e.g. hocon, properties, yaml, xml, etc.) into JSON.

Building

Prerequisites:

Building:

vertx-utils> mvn verify

To use the local version you must first install it locally:

vertx-utils> mvn install

You can determine the version of the local build from the pom file. Using the local version is intended only for testing or development.

License

Published under Apache Software License 2.0, see LICENSE

© Groupon Inc., 2015

com.groupon.vertx

Groupon

Versions

Version
3.5.2
3.5.0
3.4.1
3.4.0
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.1.1
3.1.0
3.0.1