feat: CDI-managed Lettuce beans with Vert.x event loop integration#2
Open
vchomakov wants to merge 2 commits into
Open
feat: CDI-managed Lettuce beans with Vert.x event loop integration#2vchomakov wants to merge 2 commits into
vchomakov wants to merge 2 commits into
Conversation
0ed4675 to
8f15dcb
Compare
Dgramada
reviewed
Jun 16, 2026
Add deployment processor and runtime recorder to register Lettuce RedisClient, StatefulRedisConnection, and ClientResources as CDI synthetic beans, sharing Vert.x event loops via the foundation classes added in the previous PR. - LettuceProcessor: build-time processor that scans for Lettuce injection points and registers synthetic beans per client name - LettuceRecorder: runtime recorder managing lifecycle of Lettuce clients with proper shutdown ordering - RequestedLettuceClientBuildItem: Lettuce-specific build item to isolate Lettuce bean creation from other Redis processors Tests covering default client, named clients, inactive clients, missing hosts, and multiple client coexistence.
…s client stack Address review feedback on the CDI bean wiring: - Do not produce RequestedRedisClientBuildItem from the Lettuce processor. That item drives the Vert.x processors, so every Lettuce injection was also creating a parallel Vert.x Redis client and a Vert.x-backed RedisDataSource. Add a test asserting a Lettuce-only application produces no Vert.x Redis or data source beans. - Use ConcurrentHashMap for the recorder's factory/connection maps, which are populated lazily at runtime via computeIfAbsent. - Adapt to the renamed LettuceClientResources#clientResources() accessor.
8f15dcb to
d8f4961
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CDI-managed Lettuce beans with Vert.x event loop integration
Builds on top of the Lettuce + Vert.x foundation from the previous PR to provide seamless CDI injection of Lettuce Redis beans.
What this PR adds
Deployment processor (
LettuceProcessor) with two build steps:detectLettuceUsage— scans injection points for Lettuce types (RedisClient,StatefulRedisConnection,ClientResources) and emits build items only for clients that are actually neededinit— registers synthetic CDI beans per client name via the recorderRuntime recorder (
LettuceRecorder) that manages the full lifecycle:ClientResourcesbacked by Vert.x event loopsRedisClientandStatefulRedisConnectioninstancescheckActiveguards for clear error messages on misconfigured clientsLettuce-specific build item (
RequestedLettuceClientBuildItem) to isolate Lettuce bean creation from other Redis processors (Vert.x Redis, Redis Cache, OIDC Redis). This prevents Lettuce from attempting connections for non-Lettuce clients.Usage
Tests
@RedisClientNameClientResourcesactive=false) produces clearInactiveBeanExceptionInactiveBeanException