Utility code for java and jvm-based languages
Switch branches/tags
java-util-1.3.3 java-util-1.3.2 java-util-1.3.1 java-util-1.3.0 java-util-1.3 java-util-1.2 java-util-1.1 java-util-1.0 java-util-0.29.1 java-util-0.29.0 java-util-0.28.2 java-util-0.28.1 java-util-0.28.0 java-util-0.27.12 java-util-0.27.12-mmx-druid java-util-0.27.11 java-util-0.27.10 java-util-0.27.9 java-util-0.27.8 java-util-0.27.7 java-util-0.27.6 java-util-0.27.5 java-util-0.27.4 java-util-0.27.3 java-util-0.27.2 java-util-0.27.1 java-util-0.27.0 java-util-0.26.15 java-util-0.26.14 java-util-0.26.13 java-util-0.26.12 java-util-0.26.11 java-util-0.26.10 java-util-0.26.9 java-util-0.26.8 java-util-0.26.7 java-util-0.26.6 java-util-0.26.5 java-util-0.26.4 java-util-0.26.3 java-util-0.26.2 java-util-0.26.1 java-util-0.26.0 java-util-0.25.6 java-util-0.25.5 java-util-0.25.4 java-util-0.25.3 java-util-0.25.2 java-util-0.25.1 java-util-0.25.0 java-util-0.24.0 java-util-0.23.0 java-util-0.22.6 java-util-0.22.5 java-util-0.22.4 java-util-0.22.3 java-util-0.22.2 java-util-0.22.1 java-util-0.22.0 java-util-0.21.0 java-util-0.20.0 java-util-0.19.1 java-util-0.19.0 java-util-0.18.1 java-util-0.18.0 java-util-0.16.0 java-util-0.15.1 java-util-0.15.0 java-util-0.14.0 java-util-0.13.0 java-util-0.12.0 java-util-0.11.0 java-util-0.10.7 java-util-0.10.6 java-util-0.10.5 java-util-0.10.4 java-util-0.10.3 java-util-0.10.2 java-util-0.10.1 java-util-0.10.0 java-util-0.9.12 java-util-0.9.11 java-util-0.9.9 java-util-0.9.8 java-util-0.9.7 java-util-0.9.6 java-util-0.9.5 java-util-0.9.4 java-util-0.9.3 java-util-0.9.2 java-util-0.9.1 java-util-0.9.0 java-util-0.8.4 java-util-0.8.3 java-util-0.8.2 java-util-0.8.1 java-util-0.8.0 java-util-0.7.1 java-util-0.7.0 java-util-0.6.6
Nothing to show
Clone or download


Build Status


Utility code for java and jvm-based languages.

com.metamx.http - HTTP client

This is an async HTTP client library that provides two basic functions:

  1. a channel caching pool for Netty channels that works well for inter-service communication
  2. the absolute minimum abstractions on top of Netty's HTTP support to make it a little easier to issue requests

com.metamx.emitter - Event Emitter

Emitter creation

The easiest way to create an emmiter instance is via com.metamx.emitter.core.Emitters.create method. This method will create one of the predefined emitters or your own implementation based on the properties provided. com.metamx.emitter.type property value defines what Emitter should be created.

Emitter types

Logging emitter

com.metamx.emitter.type = logging will create LoggingEmitter. For more details on LoggingEmitter configuration please refer com.metamx.emitter.core.LoggingEmitterConfig

Http emitter

com.metamx.emitter.type = http will create HttpPostEmitter. The only required parameter is com.metamx.emitter.recipientBaseUrl that is a url where all the events will be sent too. For more details on HttpPostEmitter configuration please refer com.metamx.emitter.core.HttpEmitterConfig

Parametrized URI http emitter

com.metamx.emitter.type = parametrized will create ParametrizedUriEmitter. ParametrizedUriEmitter is a http emitter that can be used when events should be posted to different url based on event data. The URI pattern is defined via com.metamx.emitter.recipientBaseUrlPattern property. For instance: com.metamx.emitter.recipientBaseUrlPattern=http://example.com/{feed} will make it send events to different endpoints according to event.getFeed value. com.metamx.emitter.recipientBaseUrlPattern=http://example.com/{key1}/{key2} requires that key1 and key2 are defined in event map.

Custom emitter

To create your own emitter you need to implement EmitterFactory and add it as registered type to ObjectMapper that is used to call Emitters.create. com.metamx.emitter.type property should be set to the type name of registered subclass that is usually set with an annotation @JsonTypeName("my_custom_emitter") You can refer to com.metamx.emitter.core.CustomEmitterFactoryTest for an example of custom emitter creation. All properties with com.metamx.emitter.* prefix will be translated into configuration json used to create Emitter. Consider the following example:

com.metamx.emitter.type = my_custom_emitter
com.metamx.emitter.key1 = val1
com.metamx.emitter.outer.inner1 = inner_val1
com.metamx.emitter.outer.inner2 = inner_val2

will be translated into:

  "type": "my_custom_emitter",
  "key1": "val1",
      "inner1": "inner_val1",
      "inner2": "inner_val2"

com.metamx.metrics - Server Metrics

A library for emitting server-metrics