add publish command to Pipeline
This commit is contained in:
@@ -1155,4 +1155,14 @@ public class Pipeline extends Queable {
|
||||
public void multi() {
|
||||
client.multi();
|
||||
}
|
||||
|
||||
public Response<Long> publish(String channel, String message) {
|
||||
client.publish(channel, message);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
public Response<Long> publish(byte[] channel, byte[] message) {
|
||||
client.publish(channel, message);
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,4 +103,15 @@ public class PipeliningTest extends Assert {
|
||||
string.get();
|
||||
p.sync();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pipelineWithPubSub() {
|
||||
Pipeline pipelined = jedis.pipelined();
|
||||
Response<Long> p1 = pipelined.publish("foo", "bar");
|
||||
Response<Long> p2 = pipelined.publish("foo".getBytes(), "bar"
|
||||
.getBytes());
|
||||
pipelined.sync();
|
||||
assertEquals(0, p1.get().longValue());
|
||||
assertEquals(0, p2.get().longValue());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user