Dropwizard Jest

A Dropwizard Bundle for accessing Elasticsearch.

License

License

Categories

Categories

DropWizard Container Microservices Jest Data Databases
GroupId

GroupId

com.meltmedia.dropwizard
ArtifactId

ArtifactId

dropwizard-jest
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

Dropwizard Jest
A Dropwizard Bundle for accessing Elasticsearch.
Project Organization

Project Organization

meltmedia

Download dropwizard-jest

How to add to project

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

Dependencies

compile (5)

Group / Artifact Type Version
io.dropwizard : dropwizard-configuration jar 0.8.4
io.dropwizard : dropwizard-core jar 0.8.4
com.google.inject : guice Optional jar 4.0-beta5
io.searchbox : jest jar 0.1.7
junit : junit Optional jar 4.11

test (2)

Group / Artifact Type Version
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-all jar 1.10.8

Project Modules

There are no modules declared in this project.

Dropwizard Jest

A Dropwizard bundle for the Jest Elasticsearch Client.

Build Status

Usage

Maven

Releases of this project are available on Maven Central. You can include the project with this dependency:

<dependency>
  <groupId>com.meltmedia.dropwizard</groupId>
  <artifactId>dropwizard-jest</artifactId>
  <version>0.3.0</version>
</dependency>

To use SNAPSHOTs of this project, you will need to include the sonatype repository in your POM.

<repositories>
    <repository>
        <snapshots>
        <enabled>true</enabled>
        </snapshots>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>

You will also need to include the project in your dependencies.

<dependency>
  <groupId>com.meltmedia.dropwizard</groupId>
  <artifactId>dropwizard-jest</artifactId>
  <version>0.4.0-SNAPSHOT</version>
</dependency>

Java

Define the JestConfiguraion class somewhere in your applications configuration.

import com.meltmedia.dropwizard.jest.JestConfiguration;

...

  @JsonProperty
  protected JestConfiguration elasticsearch;

  public JestConfiguration getElasticsearch() {
    return jest;
  }

Then include the bundle in the initialize method of your application.

import com.meltmedia.dropwizard.jest.JestBundle;

...
protected JestBundle jestBundle;

@Override
public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
  bootstrap.addBundle(jestBundle = JestBundle.<ExampleConfiguration>builder()
    .withConfiguration(ExampleConfiguration::getElasticsearch)
    .build());
}

Finally, use the bundle to access the client supplier.

@Override
public void run(ExampleConfiguration config, Environment env) throws Exception {
  JestClient client = jestBundle.getClientSupplier().get();
}

Configuration

Add the jest configuraiton block to your applications config.

elasticsearch:
  clusterName: elasticsearch
  servers:
  - 'http://localhost:9200'

Building

This project builds with Java 8 and Maven 3. After cloning the repo, install the bundle from the root of the project.

mvn clean install

Integration Tests

Run the build with the integration-tests profile.

mvn clean install -P integration-tests

Contributing

This project accepts PRs, so feel free to fork the project and send contributions back.

Formatting

This project contains formatters to help keep the code base consistent. The formatter will update Java source files and add headers to other files. When running the formatter, I suggest the following procedure:

  1. Make sure any outstanding stages are staged. This will prevent the formatter from destroying your code.
  2. Run mvn format, this will format the source and add any missing license headers.
  3. If the changes look good and the project still compiles, add the formatting changes to your staged code.

If things go wrong, you can run git checkout -- . to drop the formatting changes.

com.meltmedia.dropwizard

Meltmedia

Versions

Version
0.4.0
0.3.0
0.2.0
0.1.0