diff --git a/content/develop/use-cases/cache-aside/java-lettuce/_index.md b/content/develop/use-cases/cache-aside/java-lettuce/_index.md index f8cf5d96b4..ce6a5c58a6 100644 --- a/content/develop/use-cases/cache-aside/java-lettuce/_index.md +++ b/content/develop/use-cases/cache-aside/java-lettuce/_index.md @@ -275,6 +275,31 @@ If your Redis server is running elsewhere, start the demo with `--redis-host` an ## Running the demo +### Get Lettuce and its dependencies + +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: + +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` + +### Start the demo server + A local demo server is included to show the cache-aside layer in action ([source](DemoServer.java)): diff --git a/content/develop/use-cases/job-queue/java-lettuce/_index.md b/content/develop/use-cases/job-queue/java-lettuce/_index.md index e9c57f80ed..1d2b1667b9 100644 --- a/content/develop/use-cases/job-queue/java-lettuce/_index.md +++ b/content/develop/use-cases/job-queue/java-lettuce/_index.md @@ -296,14 +296,14 @@ Add Lettuce to your project: io.lettuce lettuce-core - 6.7.1.RELEASE + 7.9.0.RELEASE ``` * If you use **Gradle**: ```groovy - implementation 'io.lettuce:lettuce-core:6.7.1.RELEASE' + implementation 'io.lettuce:lettuce-core:7.9.0.RELEASE' ``` ## Running the demo @@ -321,9 +321,32 @@ curl -O $BASE/WorkerPool.java curl -O $BASE/DemoServer.java ``` +### Get Lettuce and its dependencies + +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: + +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` + ### Start the demo server -From that directory, compile the sources and run the server. With the Lettuce + netty + reactor jars staged in a local `lib/` directory: +From that directory, compile the sources and run the server: ```bash javac -cp "lib/*" -d build RedisJobQueue.java JobWorker.java WorkerPool.java DemoServer.java diff --git a/content/develop/use-cases/leaderboard/java-lettuce/DemoServer.java b/content/develop/use-cases/leaderboard/java-lettuce/DemoServer.java index 8029861f23..104127f10d 100644 --- a/content/develop/use-cases/leaderboard/java-lettuce/DemoServer.java +++ b/content/develop/use-cases/leaderboard/java-lettuce/DemoServer.java @@ -20,8 +20,8 @@ * Redis leaderboard demo server using the async Lettuce implementation. * * Usage: - * javac -cp lettuce-core-6.7.1.RELEASE.jar AsyncRedisLeaderboard.java ReactiveRedisLeaderboard.java DemoServer.java - * java -cp .:lettuce-core-6.7.1.RELEASE.jar DemoServer [--port PORT] [--redis-host HOST] [--redis-port PORT] + * javac -cp 'lib/*' AsyncRedisLeaderboard.java ReactiveRedisLeaderboard.java DemoServer.java + * java -cp '.:lib/*' DemoServer [--port PORT] [--redis-host HOST] [--redis-port PORT] */ public class DemoServer { diff --git a/content/develop/use-cases/leaderboard/java-lettuce/_index.md b/content/develop/use-cases/leaderboard/java-lettuce/_index.md index ca223ad406..355cf38d81 100644 --- a/content/develop/use-cases/leaderboard/java-lettuce/_index.md +++ b/content/develop/use-cases/leaderboard/java-lettuce/_index.md @@ -52,14 +52,14 @@ Add the Lettuce dependency to your project: io.lettuce lettuce-core - 6.7.1.RELEASE + 7.9.0.RELEASE ``` * If you use **Gradle**: ```groovy - implementation 'io.lettuce:lettuce-core:6.7.1.RELEASE' + implementation 'io.lettuce:lettuce-core:7.9.0.RELEASE' ``` ### Lettuce vs Jedis @@ -253,16 +253,39 @@ curl -O $BASE/ReactiveRedisLeaderboard.java curl -O $BASE/DemoServer.java ``` +### Get Lettuce and its dependencies + +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: + +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` + ### Start the demo server A local demo server ([source](https://github.com/redis/docs/blob/main/content/develop/use-cases/leaderboard/java-lettuce/DemoServer.java)) is included to show the leaderboard in action: ```bash # Compile -javac -cp lettuce-core-6.7.1.RELEASE.jar AsyncRedisLeaderboard.java ReactiveRedisLeaderboard.java DemoServer.java +javac -cp 'lib/*' AsyncRedisLeaderboard.java ReactiveRedisLeaderboard.java DemoServer.java # Run the demo server -java -cp .:lettuce-core-6.7.1.RELEASE.jar DemoServer +java -cp '.:lib/*' DemoServer ``` The demo uses the async implementation for the HTTP handlers and provides an interactive web interface where you can: diff --git a/content/develop/use-cases/prefetch-cache/java-lettuce/_index.md b/content/develop/use-cases/prefetch-cache/java-lettuce/_index.md index d158bacd15..ed61f40268 100644 --- a/content/develop/use-cases/prefetch-cache/java-lettuce/_index.md +++ b/content/develop/use-cases/prefetch-cache/java-lettuce/_index.md @@ -292,20 +292,25 @@ curl -O $BASE/SyncWorker.java curl -O $BASE/DemoServer.java ``` -You also need Lettuce and its runtime dependencies on your classpath. The simplest way is to download them into a local `lib/` directory: +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: ```bash -mkdir lib && cd lib -LETTUCE=https://repo1.maven.org/maven2/io/lettuce/lettuce-core/6.5.0.RELEASE -curl -O $LETTUCE/lettuce-core-6.5.0.RELEASE.jar -NETTY=https://repo1.maven.org/maven2/io/netty -for ARTIFACT in netty-buffer netty-codec netty-common netty-handler \ - netty-resolver netty-transport netty-transport-native-unix-common; do - curl -O "$NETTY/$ARTIFACT/4.1.113.Final/$ARTIFACT-4.1.113.Final.jar" -done -curl -O https://repo1.maven.org/maven2/io/projectreactor/reactor-core/3.6.6/reactor-core-3.6.6.jar -curl -O https://repo1.maven.org/maven2/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar -cd .. +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib ``` ### Start the demo server diff --git a/content/develop/use-cases/pub-sub/java-lettuce/_index.md b/content/develop/use-cases/pub-sub/java-lettuce/_index.md index c570e2b238..487dba3066 100644 --- a/content/develop/use-cases/pub-sub/java-lettuce/_index.md +++ b/content/develop/use-cases/pub-sub/java-lettuce/_index.md @@ -254,13 +254,26 @@ curl -O $BASE/RedisPubSubHub.java curl -O $BASE/DemoServer.java ``` -You also need a `lib/` directory containing the Lettuce client and its runtime dependencies — at minimum: +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: -* `lettuce-core-6.x.jar` -* `netty-buffer-4.1.x.jar`, `netty-codec-4.1.x.jar`, `netty-common-4.1.x.jar`, `netty-handler-4.1.x.jar`, `netty-resolver-4.1.x.jar`, `netty-transport-4.1.x.jar`, `netty-transport-native-unix-common-4.1.x.jar` -* `reactor-core-3.x.jar`, `reactive-streams-1.0.x.jar` - -The simplest way to collect them is with Maven. Create a minimal `pom.xml` declaring `io.lettuce:lettuce-core` as the only dependency, then run `mvn dependency:copy-dependencies -DoutputDirectory=lib`. +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` ### Start the demo server diff --git a/content/develop/use-cases/rate-limiter/java-lettuce/_index.md b/content/develop/use-cases/rate-limiter/java-lettuce/_index.md index e825508854..038b714c84 100644 --- a/content/develop/use-cases/rate-limiter/java-lettuce/_index.md +++ b/content/develop/use-cases/rate-limiter/java-lettuce/_index.md @@ -125,14 +125,14 @@ Add the Lettuce dependency to your project: io.lettuce lettuce-core - 6.7.1.RELEASE + 7.9.0.RELEASE ``` * If you use **Gradle**: ```groovy - implementation 'io.lettuce:lettuce-core:6.7.1.RELEASE' + implementation 'io.lettuce:lettuce-core:7.9.0.RELEASE' ``` ### Lettuce vs Jedis @@ -308,6 +308,29 @@ curl -O $BASE/ReactiveTokenBucket.java curl -O $BASE/DemoServer.java ``` +### Get Lettuce and its dependencies + +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: + +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` + ### Start the demo server A demonstration HTTP server is included to show the rate limiter in action @@ -315,10 +338,10 @@ A demonstration HTTP server is included to show the rate limiter in action ```bash # Compile -javac -cp lettuce-core-6.7.1.RELEASE.jar TokenBucket.java DemoServer.java +javac -cp 'lib/*' TokenBucket.java DemoServer.java # Run the demo server -java -cp .:lettuce-core-6.7.1.RELEASE.jar DemoServer +java -cp '.:lib/*' DemoServer ``` The demo provides an interactive web interface where you can: diff --git a/content/develop/use-cases/session-store/java-lettuce/_index.md b/content/develop/use-cases/session-store/java-lettuce/_index.md index b95f5af854..55a3d60e0a 100644 --- a/content/develop/use-cases/session-store/java-lettuce/_index.md +++ b/content/develop/use-cases/session-store/java-lettuce/_index.md @@ -187,14 +187,14 @@ Add Lettuce to your project: io.lettuce lettuce-core - 6.7.1.RELEASE + 7.9.0.RELEASE ``` * If you use **Gradle**: ```groovy - implementation 'io.lettuce:lettuce-core:6.7.1.RELEASE' + implementation 'io.lettuce:lettuce-core:7.9.0.RELEASE' ``` ## Running the demo @@ -211,14 +211,37 @@ curl -O $BASE/ReactiveSessionStore.java curl -O $BASE/DemoServer.java ``` +### Get Lettuce and its dependencies + +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: + +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` + ### Start the demo server A local demo server is included to show the session store in action ([source](https://github.com/redis/docs/blob/main/content/develop/use-cases/session-store/java-lettuce/DemoServer.java)): ```bash -javac -cp lettuce-core-6.7.1.RELEASE.jar AsyncSessionStore.java DemoServer.java -java -cp .:lettuce-core-6.7.1.RELEASE.jar DemoServer +javac -cp 'lib/*' AsyncSessionStore.java DemoServer.java +java -cp '.:lib/*' DemoServer ``` The demo uses the async Lettuce API and exposes a small interactive page where you can: diff --git a/content/develop/use-cases/streaming/java-lettuce/_index.md b/content/develop/use-cases/streaming/java-lettuce/_index.md index 090d2d8f68..083bfa5737 100644 --- a/content/develop/use-cases/streaming/java-lettuce/_index.md +++ b/content/develop/use-cases/streaming/java-lettuce/_index.md @@ -338,20 +338,25 @@ curl -O $BASE/ConsumerWorker.java curl -O $BASE/DemoServer.java ``` -You also need Lettuce and its runtime dependencies on your classpath. The simplest way is to download them into a local `lib/` directory: +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: ```bash -mkdir lib && cd lib -LETTUCE=https://repo1.maven.org/maven2/io/lettuce/lettuce-core/6.5.0.RELEASE -curl -O $LETTUCE/lettuce-core-6.5.0.RELEASE.jar -NETTY=https://repo1.maven.org/maven2/io/netty -for ARTIFACT in netty-buffer netty-codec netty-common netty-handler \ - netty-resolver netty-transport netty-transport-native-unix-common; do - curl -O "$NETTY/$ARTIFACT/4.1.113.Final/$ARTIFACT-4.1.113.Final.jar" -done -curl -O https://repo1.maven.org/maven2/io/projectreactor/reactor-core/3.6.6/reactor-core-3.6.6.jar -curl -O https://repo1.maven.org/maven2/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar -cd .. +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib ``` ### Start the demo server diff --git a/content/develop/use-cases/time-series-dashboard/java-lettuce/_index.md b/content/develop/use-cases/time-series-dashboard/java-lettuce/_index.md index f99ed71ebd..14710a4d50 100644 --- a/content/develop/use-cases/time-series-dashboard/java-lettuce/_index.md +++ b/content/develop/use-cases/time-series-dashboard/java-lettuce/_index.md @@ -154,7 +154,7 @@ If you use Maven: io.lettuce lettuce-core - 6.7.1.RELEASE + 7.9.0.RELEASE ``` @@ -173,19 +173,42 @@ curl -O $BASE/ReactiveRedisTimeSeriesStore.java curl -O $BASE/DemoServer.java ``` +### Get Lettuce and its dependencies + +Lettuce needs Netty, Reactor and a few other jars at runtime, and `javac` and `java` need them on the classpath. The simplest way to collect them is with Maven. In the demo directory, create a minimal `pom.xml`, then copy its dependencies into a local `lib/` directory: + +```bash +cat > pom.xml <<'EOF' + + 4.0.0 + demo + demo + 1 + + + io.lettuce + lettuce-core + 7.9.0.RELEASE + + + +EOF +mvn -q dependency:copy-dependencies -DoutputDirectory=lib +``` + ### Start the demo server Compile and run the demo: ```bash -javac -cp lettuce-core-6.7.1.RELEASE.jar:reactor-core-3.6.6.jar:reactive-streams-1.0.4.jar SensorSimulator.java AsyncRedisTimeSeriesStore.java ReactiveRedisTimeSeriesStore.java DemoServer.java -java -cp .:lettuce-core-6.7.1.RELEASE.jar:reactor-core-3.6.6.jar:reactive-streams-1.0.4.jar DemoServer +javac -cp 'lib/*' SensorSimulator.java AsyncRedisTimeSeriesStore.java ReactiveRedisTimeSeriesStore.java DemoServer.java +java -cp '.:lib/*' DemoServer ``` The server accepts optional flags if your Redis instance is not on the default host and port: ```bash -java -cp .:lettuce-core-6.7.1.RELEASE.jar:reactor-core-3.6.6.jar:reactive-streams-1.0.4.jar DemoServer --redis-host 127.0.0.1 --redis-port 6379 --port 8080 +java -cp '.:lib/*' DemoServer --redis-host 127.0.0.1 --redis-port 6379 --port 8080 ``` After starting the server, visit `http://localhost:8080`.