lettuce
lettuce copied to clipboard
Transaction Discard function seems not work when use reactive command
Describe the solution you'd like
RedisReactiveCommands<String, String> reactive = client.connect().reactive();
reactive.watch("key").subscribe();
reactive.multi().subscribe(multiResponse -> {
reactive.set("key", "1").subscribe();
reactive.incr("key").subscribe(); // Assume it gets RuntimeException
reactive.exec().subscribe();
}, e -> reactive.discard().subscribe());
The program above can not rollback if command incr gets wrong. How can i discard the transaction above ?