Code Monkey home page Code Monkey logo

cartridge-java's Introduction

Java driver for Tarantool Cartridge

java-driver:ubuntu/master Actions Status

Java driver for Tarantool Cartridge for Tarantool versions 1.10+ based on the asynchronous Netty framework and official MessagePack serializer. Provides CRUD APIs for seamlessly working with standalone Tarantool servers and clusters managed by Tarantool Cartridge with sharding via vshard.

Quickstart

Example of single instance Tarantool application and java app connected using cartridge-java.

The easiest way to start experimenting with cartridge-java and single instance tarantool app is to use single instance test. You can set breakpoints and run it in debug mode. Testcontainers will start single instance tarantool application for you. So you will be able to manipulate data in Tarantool in real life through java expressions or Tarantool console.

If you want to start tarantool application manually all you need is to run this file in tarantool

tarantool src/test/resources/single-instance.lua

Example of TarantoolClient set up https://github.com/tarantool/cartridge-java/blob/2f8e826deb9833a5deb6d21177527a46e8fdd039/src/test/java/io/tarantool/driver/integration/SingleInstanceExampleTest.java#L51-L59

Example of client API usage https://github.com/tarantool/cartridge-java/blob/2f8e826deb9833a5deb6d21177527a46e8fdd039/src/test/java/io/tarantool/driver/integration/SingleInstanceExampleTest.java#L64-L79

You can read more about Cartridge applications in its documentation. Also look at available Cartridge application examples.

If you use this code in another project don't forget to add cartridge-driver dependency:

<dependency>
  <groupId>io.tarantool</groupId>
  <artifactId>cartridge-driver</artifactId>
  <version>0.10.1</version>
</dependency>

Advanced usage

  • Cluster client
    Connecting to Tarantool nodes.
    The client can connect to storages and obtain data from spaces directly by space interface via native iproto binary protocol.
    It may call lua storing procedures or eval lua code on nodes.
  • Proxy methods
    Connecting to routers with crud library. It proxies space interface's methods to crud methods.
  • Retrying
    Retrying transient cluster failures.
  • TarantoolTuple usage
    Creating and operating with TarantoolTuple entity.
  • Custom sharding function
    Determining bucket id on java side.
  • Thread control
    Specifying custom numbers of netty work threads.

Documentation

The Java Docs are available at Github pages.

If you have any questions about working with Tarantool, check out the site tarantool.io.

Feel free to ask questions about Tarantool and usage of this driver on Stack Overflow with tag tarantool or join our community support chats in Telegram: English and Russian.

Requirements

Java 1.8 or higher is required for building and using this driver.

Building

  1. Docker accessible to the current user is required for running integration tests.
  2. Set up the right user for running Tarantool with in the container:
export TARANTOOL_SERVER_USER=<current user>
export TARANTOOL_SERVER_GROUP=<current group>

Substitute the user and group in these commands with the user and group under which the tests will run. 3. Use ./mvnw verify to run unit tests and ./mvnw test -Pintegration to run integration tests. 4. Use ./mvnw install for installing the artifact locally.

Contributing

Contributions to this project are always welcome and highly encouraged. See conventions for tests

cartridge-java's People

Contributors

akudiyar avatar artdu avatar wey1and avatar vrogach2020 avatar savolgin avatar idneprov avatar elishtar avatar dkasimovskiy avatar isopov avatar savolgin73 avatar dimoffon avatar devrishal avatar anatennis avatar vkartdu avatar dependabot[bot] 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.