public class SimpleKestrelClient extends Object implements Closeable
KestrelThriftClient
which seemed to have some major issuesConstructor and Description |
---|
SimpleKestrelClient(InetSocketAddress addr)
initialise a
Client instance using ServiceFactory from a
ClientBuilder |
SimpleKestrelClient(String host,
int port)
Initialise an
InetSocketAddress.InetSocketAddress(String, int)
instance |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete(String queueName)
Calls
Client.delete(String) on the underlying Client
instance. |
String |
get(String queueName)
Get the next value in the queue
|
String |
get(String queueName,
com.twitter.util.Duration waitDuration)
Get the next value from the queue
|
String |
get(String queueName,
int waitFor)
Get the next value in the queue
|
byte[] |
getByte(String queueName)
Get the next value in the queue
|
byte[] |
getByte(String queueName,
com.twitter.util.Duration waitDuration)
Get the next value from the queue
|
byte[] |
getByte(String queueName,
int waitFor)
Get the next value in the queue
|
String |
peek(String queueName)
Get the next value without popping it
|
String |
peek(String queueName,
com.twitter.util.Duration waitDuration)
The next value without popping it
|
String |
peek(String queueName,
int waitFor)
The next value without popping it
|
byte[] |
peekByte(String queueName)
Get the next value without popping it
|
byte[] |
peekByte(String queueName,
com.twitter.util.Duration waitDuration)
The next value without popping it
|
byte[] |
peekByte(String queueName,
int waitFor)
The next value without popping it
|
void |
set(String queueName,
byte[] value)
Performs a put with the byte array value with no expiration
|
void |
set(String queueName,
int exp,
byte[] value)
Performs a put with the byte array valye with an expiration
|
void |
set(String queueName,
int exp,
String value)
Performs a put kestrel call with the provided expiration.
|
void |
set(String queueName,
String value)
Performs a put kestrel call on the string value with a expiary of 0 (i.e.
|
public SimpleKestrelClient(String host, int port)
InetSocketAddress.InetSocketAddress(String, int)
instancehost
- port
- public SimpleKestrelClient(InetSocketAddress addr)
Client
instance using ServiceFactory
from a
ClientBuilder
addr
- public void delete(String queueName)
Client.delete(String)
on the underlying Client
instance. This deletes the underlying journal instance in the kestrel
queuequeueName
- public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void set(String queueName, String value)
queueName
- value
- public void set(String queueName, int exp, String value)
queueName
- exp
- value
- public void set(String queueName, byte[] value)
queueName
- value
- public void set(String queueName, int exp, byte[] value)
queueName
- exp
- value
- public String get(String queueName)
queueName
- public byte[] getByte(String queueName)
queueName
- public byte[] getByte(String queueName, int waitFor)
queueName
- waitFor
- public String get(String queueName, int waitFor)
queueName
- waitFor
- public String get(String queueName, com.twitter.util.Duration waitDuration)
queueName
- waitDuration
- public byte[] getByte(String queueName, com.twitter.util.Duration waitDuration)
queueName
- waitDuration
- an amount of time to wait before returning nullpublic String peek(String queueName)
queueName
- public String peek(String queueName, int waitFor)
queueName
- waitFor
- an amount of time to wait before returning nullpublic String peek(String queueName, com.twitter.util.Duration waitDuration)
queueName
- waitDuration
- an amount of time to wait before returning nullpublic byte[] peekByte(String queueName)
queueName
- public byte[] peekByte(String queueName, int waitFor)
queueName
- waitFor
- an amount of time to wait before returning null