add publish to transaction

This commit is contained in:
Jonathan Leibiusky
2011-05-11 19:53:20 -03:00
parent 66b0a5784d
commit 86fdf63cc9
2 changed files with 22 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -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());
}
}