Add gateway-mvc: Spring Cloud Gateway Server MVC 5.1 on Boot 4.2.0 + virtual threads, retry, Redis rate limiting

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3W3uHbHAmM3orhn7b
This commit is contained in:
asmhatre
2026-11-26 00:55:16 +05:30
co-authored by Claude Sonnet 5.5
parent 7211b0fb80
commit 32086c1f5b
19 changed files with 821 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
# Shared helpers. Source me from the other scripts.
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$HERE/scripts/env.sh"
JAR="$HERE/target/gateway-mvc-1.0.0.jar"
LOGDIR="${LOGDIR:-/tmp/gwmvc-logs}"; mkdir -p "$LOGDIR"
# Kill by main-class pattern kept in a variable so this very script's command line never matches it.
stop_all() {
local pat='gateway-mvc-1.0.0[.]jar|scripts/Upstream[.]java'
for p in $(ps -eo pid,args | grep -E "$pat" | grep -v grep | awk '{print $1}'); do kill "$p" 2>/dev/null; done
sleep 2
}
wait_http() { for _ in $(seq 1 60); do curl -s -o /dev/null "$1" && return 0; sleep 1; done; return 1; }
start_upstream() {
setsid nohup java "$HERE/scripts/Upstream.java" 9091 > "$LOGDIR/upstream.log" 2>&1 < /dev/null &
wait_http http://localhost:9091/hello
}
# start_gateway <port> [extra spring args...]
start_gateway() {
local port="$1"; shift
setsid nohup java -jar "$JAR" --server.port="$port" "$@" > "$LOGDIR/gateway-$port.log" 2>&1 < /dev/null &
wait_http "http://localhost:$port/diag/thread"
}
# show <curl args...> : prints the command, then status line + interesting headers + body
show() {
echo "\$ curl -i $*"
curl -si "$@" | tr -d '\r' | grep -viE '^(date|content-length|connection|keep-alive|transfer-encoding):'
echo
}