Add keda: Spring Boot 4.2.0 Kafka consumers under KEDA autoscaling (partition cap, lag maths, rebalances, SIGTERM vs SIGKILL)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
This commit is contained in:
Claude
2026-12-02 00:07:44 +05:30
parent 5facfdc212
commit 0b31b49571
24 changed files with 1212 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# One consumer thread per pod; KEDA adds pods.
app:
topic: orders
work-ms: 0
spring:
application:
name: keda-consumer
kafka:
bootstrap-servers: ${KAFKA_BOOTSTRAP:localhost:9092}
consumer:
group-id: orders-consumer
auto-offset-reset: earliest
enable-auto-commit: false # the container commits after each batch
max-poll-records: 50
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
# cooperative rebalancing: pods joining/leaving only move the partitions that must move
partition.assignment.strategy: org.apache.kafka.clients.consumer.CooperativeStickyAssignor
session.timeout.ms: 15000
listener:
concurrency: 1
# how long a stopping container waits for the in-flight batch (Spring Kafka default 10s)
shutdown-timeout: 20s
lifecycle:
# must be shorter than the pod's terminationGracePeriodSeconds
timeout-per-shutdown-phase: 25s
server:
shutdown: graceful
management:
endpoint:
health:
probes:
enabled: true
endpoints:
web:
exposure:
include: health