Git Product home page Git Product logo

dropwizard-tinkerpop's Introduction

dropwizard-tinkerpop

Build Status

A Dropwizard library that enables connectivity to Apache TinkerPop enabled gremlin servers.

See this blog post for a simple getting started guide.

Components

  • Configuration
  • Health Check
  • Managed Cluster

Configuration

The configuration class includes all of the parameters required to configure a remote connection to a TinkerPop server. The default values correspond to all of the defaults specified in the TinkerPop cluster builder.

Health Check

A health check is setup using the dropwizard health check registry. It executes the validationQuery specified in the configuration. It will succeed if the query responds within the validationQueryTimeout specified.

Managed Connection

The Cluster built from the TinkerPopFactory is included in dropwizard's managed lifecycle. This will allow dropwizard to try and gracefully shut down the TinkerPop client connections on shutdown.

Usage

Include the dropwizard-tinkerpop library as a dependency

<dependency>
  <groupId>com.experoinc</groupId>
  <artifactId>dropwizard-tinkerpop</artifactId>
  <version>${dropwizard-tinkerpop.version}</version>
</dependency>

Include a TinkerPopFactory instance in your application config

public class AppConfig extends Configuration {

    @Valid
    @NotNull
    private TinkerPopFactory tinkerPopFactory = new TinkerPopFactory();

    @JsonProperty("tinkerPop")
    public TinkerPopFactory getTinkerPopFactory() {
        return tinkerPopFactory;
    }

    @JsonProperty("tinkerPop")
    public void setTinkerPopFactory(TinkerPopFactory tinkerPopFactory) {
        this.tinkerPopFactory = tinkerPopFactory;
    }
}

Build the TinkerPop cluster in your applications run(AppConfig ac, Environment environment) method.

public class App extends Application<AppConfig> {
    
    @Override
    public void run(AppConfig configuration, Environment environment) throws Exception {
        Cluster cluster = configuration.getTinkerPopFactory().build(environment);
    }
}

Testing

Docker Compose is required for testing. Running docker-compose up -d will start two Gremlin server containers, one for SSL and one for non-SSL testing. You can run docker-compose down to stop and remove the containers. Tests are run by running mvn clean install.

dropwizard-tinkerpop's People

Contributors

twilmes avatar chrislbs avatar

Stargazers

 avatar Josh Perryman avatar Younes Rahimi avatar  avatar  avatar

Watchers

Sebastian Good avatar Brandon Wallace avatar James Cloos avatar  avatar Brian Hall avatar Blake avatar  avatar Josh Perryman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.