xetorthio / jedisque Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
final String[] queueNames = {"key1", "key2"};
Jedisque jedisque = ConnectionPoolHelper.getPool().borrowObject();
List test = jedisque.getJob(1800 * 1000, 1, queueNames);
We found if more than one client call getJob() like above, sometimes all client will get the same job.
How to avoid this?
BTW, how to decide the timeout value, the time of put a job in to the queue is unpredictable.
Thanks!
Is it possible to add pool connection like Jedis ?
method:
public List<Job> getJob(long timeout, long count, String... queueNames)
always return null and not blocking at this point.
Currently, jedisque doesn't seem to support recovery of the client after a broken disque node has recovered. Instead of removing a broken URI (https://github.com/xetorthio/jedisque/blob/master/src/main/java/com/github/xetorthio/jedisque/BinaryJedisque.java#L41), I would suggest to retry after a certain amount of time. This allows jedisque to connect to the broken node after its recovery.
If no job is in the queue getJob()
throws an Exception. Is this the desired/expected behavior? I would rather have expected that an empty List<Job>
is returned
redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:201)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
at redis.clients.jedis.Protocol.process(Protocol.java:132)
at redis.clients.jedis.Protocol.read(Protocol.java:196)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:288)
at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:233)
at redis.clients.jedis.Connection.getObjectMultiBulkReply(Connection.java:239)
at com.github.xetorthio.jedisque.Jedisque.getJob(Jedisque.java:38)
at com.github.xetorthio.jedisque.JedisqueTest.showExceptionsOnGet(JedisqueTest.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.net.SocketInputStream.read(SocketInputStream.java:108)
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:195)
... 36 more
Jedisque currently supports String-based job bodies only. The body, however, gets serialized to/from a byte representation when being sent/consumed to/from Jedis. When dealing with byte representations in an application anyway, this results in unnecessary serialization overhead. Hence, it would be nice if Jedisque provides support for byte[] bodies as well.
hi,do you have plan to update to jedis 2.9.0.
i got an error while using jedisque 0.0.4 (depend on jedis 2.9.0) to add a job to disque-server,
error message is could not found class ProtocolCommand ,which is removed in jedis upper than 2.7.3
In your README.md ,I saw these codes:
Jedisque q = new Jedisque(
new URI("disque://192.168.0.1:7711"),
new URI("disque://192.168.0.4:8822")
);
Forgive me for being a green hand.It's really hard for me that why you need to use more than one URI instances?If we use a cluster which is with more than three nodes , how about init the Jedisque instance "q" with just on URI instance?
Like this:
Jedisque q = new Jedisque(new URI("disque://192.168.0.4:8822"));
I have read some other blogs ,know that ,if we exec command "GETJOB" with some one node (now.let's call it 'Node A', there are three nodes in this cluster ,others is named 'Node B' and 'Node C' ) in the cluster ,the Node A will request other nodes with command "GETJOB" by itself automatically , as there is no msg what we need in Node A. So,in my oppinion, we needn't init a Jedisque with so many URI instance.
I think your profile Jedisque is as great as Jedis in the end.
Hi,
is it possible to upgrade Jedisque to use Jedis 2.8.x ?
Thanks
Referred to #6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.