-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shut down Lettuce clients after job completed. Fixes #68
- Loading branch information
Showing
26 changed files
with
227 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
connectors/riot-redis/src/main/java/com/redis/riot/redis/AbstractRedisCommandCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.redis.riot.redis; | ||
|
||
import com.redis.lettucemod.api.StatefulRedisModulesConnection; | ||
import com.redis.lettucemod.api.sync.RedisModulesCommands; | ||
import com.redis.riot.AbstractRiotCommand; | ||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; | ||
import org.springframework.batch.core.job.flow.Flow; | ||
import org.springframework.batch.repeat.RepeatStatus; | ||
import org.springframework.util.ClassUtils; | ||
import picocli.CommandLine.Command; | ||
|
||
@Command | ||
public abstract class AbstractRedisCommandCommand extends AbstractRiotCommand { | ||
|
||
@Override | ||
protected Flow flow(StepBuilderFactory stepBuilderFactory) { | ||
|
||
return flow(stepBuilderFactory.get(ClassUtils.getShortName(getClass()) + "-step").tasklet((contribution, chunkContext) -> { | ||
try (StatefulRedisModulesConnection<String, String> connection = getRedisOptions().connect()) { | ||
RedisModulesCommands<String, String> commands = connection.sync(); | ||
execute(commands); | ||
return RepeatStatus.FINISHED; | ||
} | ||
}).build()); | ||
} | ||
|
||
protected abstract void execute(RedisModulesCommands<String, String> commands) throws InterruptedException; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
connectors/riot-redis/src/main/java/com/redis/riot/redis/AbstractUtilityCommand.java
This file was deleted.
Oops, something went wrong.
10 changes: 4 additions & 6 deletions
10
connectors/riot-redis/src/main/java/com/redis/riot/redis/InfoCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
package com.redis.riot.redis; | ||
|
||
import io.lettuce.core.api.sync.BaseRedisCommands; | ||
import io.lettuce.core.api.sync.RedisServerCommands; | ||
import com.redis.lettucemod.api.sync.RedisModulesCommands; | ||
import picocli.CommandLine.Command; | ||
|
||
@Command(name = "info", description = "Display INFO command output") | ||
public class InfoCommand extends AbstractUtilityCommand { | ||
public class InfoCommand extends AbstractRedisCommandCommand { | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
protected void execute(BaseRedisCommands<String, String> commands) { | ||
System.out.println(((RedisServerCommands<String, String>) commands).info()); | ||
protected void execute(RedisModulesCommands<String, String> commands) { | ||
System.out.println(commands.info()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
connectors/riot-redis/src/main/java/com/redis/riot/redis/PingCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.