-
Notifications
You must be signed in to change notification settings - Fork 4
Basic usage
DisqueClient client = DisqueClient.create("disque://host");
DisqueConnection<String, String> connection = client.connect();
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.
The DisqueURI contains the host/port and can carry authentication details. On a successful connect you get authenticated. This applies also after re-establishing a connection after connection loss.
A Disque URI can also be created from an URI string. Supported formats are:
-
disque://[password@]host[:port][,host2[:port2]][,hostN[:port2N]]
Plaintext Disque connection
-
disques://[password@]host[:port][,host2[:port2]][,hostN[:port2N]]
SSL Disque connection
-
disque-socket://socket-path
Connecting to a [Unix Domain Socket](Unix Domain Sockets)
In the case of an exception/error response from Disque, you'll receive a RedisException
containing
the error message. RedisException
is a RuntimeException
.
Using Host and Port and set the default timeout to 20 seconds
DisqueClient client = new DisqueClient("localhost", 7711);
client.setDefaultTimeout(20, TimeUnit.SECONDS)
Multiple hosts
DisqueClient client = new DisqueClient("host1:7711,host2:7711,host3:7711");
Using DisqueURI
DisqueURI disqueUri = DisqueURI.Builder.disque("localhost").withPassword("authentication").build();
DisqueClient client = new DisqueClient(disqueUri);
SSL DisqueURI
DisqueURI disqueUri = DisqueURI.Builder.disque("localhost").withSsl(true).withPassword("authentication").build();
DisqueClient client = new DisqueClient(disqueUri);
String DisqueURI
DisqueURI disqueUri = DisqueURI.create("disque://authentication@localhost:7711,localhost:7712");
DisqueClient client = new DisqueClient(disqueUri);
This wiki and the README document contains a lot of information, please take your time and read these instructions carefully.
If you run into any trouble, you may start with getting started.
We provide detailed changes for each spinach release.
Be sure to read the CONTRIBUTING guidelines before reporting a new lettuce issue or open a pull request.
If you have any questions about the lettuce usage or want to share some information with the community, please go to one of the following places:
More resources:
- Javadoc
- Build status: Travis CI
- All versions: Maven Central
- Snapshots: Sonatype OSS Repository
Intro
Getting started
Advanced usage
- QueueListener API
- SocketAddress Supplier API
- Client options
- SSL Connections
- Unix Domain Sockets
- Connection Events
- Command Interfaces
- Stateful Connections
Integration and Extension
- Codecs
- CDI Support (future)
- Spring Support (future)
Internals