add publish to transaction
This commit is contained in:
@@ -566,4 +566,15 @@ public class Transaction extends BinaryTransaction {
|
||||
client.lastsave();
|
||||
return getResponse(BuilderFactory.LONG);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -219,4 +219,15 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
|
||||
string.get();
|
||||
t.exec();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lala() {
|
||||
Transaction multi = jedis.multi();
|
||||
Response<Long> publish = multi.publish("foo", "bar");
|
||||
Response<Long> bpublish = multi.publish("foo".getBytes(), "bar"
|
||||
.getBytes());
|
||||
multi.exec();
|
||||
assertEquals(0, publish.get().longValue());
|
||||
assertEquals(0, bpublish.get().longValue());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user