spinach

Java disque client based on lettuce

License

License

Categories

Categories

Redis Data Databases
GroupId

GroupId

biz.paluch.redis
ArtifactId

ArtifactId

spinach
Last Version

Last Version

0.3
Release Date

Release Date

Type

Type

jar
Description

Description

spinach
Java disque client based on lettuce
Project URL

Project URL

http://github.com/mp911de/spinach
Source Code Management

Source Code Management

http://github.com/mp911de/spinach

Download spinach

How to add to project

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

Dependencies

compile (7)

Group / Artifact Type Version
biz.paluch.redis : lettuce jar 3.4.1.Final
io.netty : netty-common jar 4.0.34.Final
io.netty : netty-transport jar 4.0.34.Final
io.netty : netty-handler jar 4.0.34.Final
io.reactivex : rxjava jar 1.0.14
com.google.guava : guava jar 17.0
org.apache.commons : commons-pool2 jar 2.2

provided (6)

Group / Artifact Type Version
io.netty : netty-transport-native-epoll Optional jar 4.0.34.Final
org.springframework : spring-beans jar 3.1.4.RELEASE
org.springframework : spring-context jar 3.1.4.RELEASE
javax.inject : javax.inject jar 1
javax.enterprise : cdi-api jar 1.0
com.google.code.findbugs : jsr305 Optional jar 3.0.0

test (10)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5
com.google.code.tempus-fugit : tempus-fugit jar 1.1
org.apache.openwebbeans.test : cditest-owb jar 1.2.6
javax.servlet : javax.servlet-api jar 3.0.1
org.assertj : assertj-core jar 1.6.1
log4j : log4j jar 1.2.17
org.springframework : spring-test jar 3.1.4.RELEASE
org.springframework : spring-expression jar 3.1.4.RELEASE
org.hamcrest : hamcrest-library jar 1.3

Project Modules

There are no modules declared in this project.

spinach - A scalable Java Disque client

Build Status Coverage Status Maven Central

Spinach is a scalable thread-safe Disque client providing both synchronous and asynchronous APIs. Multiple threads may share one connection if they do not use blocking commands. Spinach is based on lettuce 4. Multiple connections are efficiently managed by the excellent netty NIO framework.

See the Wiki for more docs.

Communication

Documentation

Binaries/Download

Binaries and dependency information for Maven, Ivy, Gradle and others can be found at http://search.maven.org.

Releases of spinach are available in the maven central repository. Take also a look at the Download page in the Wiki.

Example for Maven:

<dependency>
  <groupId>biz.paluch.redis</groupId>
  <artifactId>spinach</artifactId>
  <version>x.y.z</version>
</dependency>

All versions: Maven Central

Snapshots: Sonatype OSS Repository

Basic Usage

DisqueClient client = DisqueClient.create(DisqueURI.create("host", 7711));
DisqueConnection<String, String> connection = client.connect().sync();
DisqueCommands<String, String> sync = connection.sync();
String jobId = sync.addjob("queue", "body", 1, TimeUnit.MINUTES);
  
Job<String, String> job = sync.getjob("queue");
connection.ackjob(job.getId());

Each Disque command is implemented by one or more methods with names identical to the lowercase Disque command name. Complex commands with multiple modifiers that change the result type include the CamelCased modifier as part of the command name.

Disque connections are designed to be long-lived, and if the connection is lost will reconnect until close() is called. Pending commands that have not timed out will be (re)sent after successful reconnection.

All connections inherit a default timeout from their DisqueClient and and will throw a DisqueException when non-blocking commands fail to return a result before the timeout expires. The timeout defaults to 60 seconds and may be changed in the DisqueClient or for each individual connection.

Asynchronous API

DisqueConnection<String, String> connection = client.connect();
DisqueAsyncCommands<String, String>  async = connection.async();
RedisFuture<String> jobId1 = async.addjob("queue", "body1", 1, SECONDS);
RedisFuture<String> jobId2 = async.addjob("queue", "body2", 1, SECONDS);

async.awaitAll(jobId1, jobId2) == true

jobId1.get() == "D-...a1"
jobId2.get() == "D-...a1"

Building

Spinach is built with Apache Maven. The tests require multiple running Disque instances for different test cases which are configured using a Makefile.

  • Run the build: make test
  • Start Disque (manually): make start
  • Stop Disque (manually): make stop

License

Contributing

Github is for social coding: if you want to write code, I encourage contributions through pull requests from forks of this repository. Create Github tickets for bugs and new features and comment on the ones that you are interested in and take a look into CONTRIBUTING.md

Versions

Version
0.3
0.2
0.1.1
0.1