Open AndyWilks79 opened 6 years ago
The way I discovered this was by adding println statements to AbstractRedisInstance.class to show the response received when starting Redis.
private void awaitRedisServerReady() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(redisProcess.getInputStream()));
try {
String outputLine;
do {
outputLine = reader.readLine();
if (outputLine == null) {
//Something goes wrong. Stream is ended before server was activated.
throw new RuntimeException("Can't start redis server. Check logs for details.");
}
System.out.println(outputLine);
System.out.println(redisReadyPattern());
} while (!outputLine.matches(redisReadyPattern()));
} finally {
IOUtils.closeQuietly(reader);
}
}
please try https://github.com/ozimov/embedded-redis.
When using a custom version of Redis, the code waits indefinitely for the Redis Server to start. This is because it is waiting for the following startup message as set on redis.embedded.RedisServer.class
REDIS_READY_PATTERN = ".The server is now ready to accept connections on port."
It appears as of version 4.0. that the final startup statement issued by Redis is now - Ready to accept connections.
As REDIS_READY_PATTERN is a final string and the method is protected access, it doesn't appear you can set the value when creating the server.