Backend Development 15 min read

Design and Implementation of a JSF Local Debugging Tool Using Redis Middleware

This article explains the background, design principles, architecture, serialization handling, asynchronous‑to‑synchronous conversion, trigger timing, ease of use, implementation details, and usage documentation of a lightweight, non‑intrusive JSF local debugging tool that leverages Redis publish/subscribe to enable seamless local integration testing for developers.

JD Tech
JD Tech
JD Tech
Design and Implementation of a JSF Local Debugging Tool Using Redis Middleware

Background: In JD internal development, JSF is the most used RPC component; frequent issues arise when multiple teams need to perform local integration testing, such as environment instability, lack of breakpoints, and missing test environments.

Design goals: The tool follows two principles – non‑intrusive (does not affect project code) and simple (requires minimal configuration).

Architecture: The solution consists of three layers – the JSF caller (yellow), a Redis‑based middleware (blue) and the JSF provider (green). Redis publish/subscribe is used as the bridge because direct network connections between development machines are often impossible.

Connectivity: Both JMQ and Redis can be used; Redis is chosen for its fast in‑memory pub/sub, automatic topic creation and no need for external registration.

Serialization: Supports MsgPack and Hessian; a custom RedisJsfSerializer implements RedisSerializer<T> to delegate to the appropriate codec.

public class RedisJsfSerializer
implements RedisSerializer
{
    private final JavaType javaType;
    private final Codec codec;
    // ... constructor and methods ...
}

Async‑to‑Sync conversion: A CountDownLatch is created, the request is published to a Redis topic, and the listener counts down when the response arrives, allowing the caller to wait synchronously.

CountDownLatch latch = new CountDownLatch(1);
subscribe(response -> latch.countDown());
publish(request);
latch.await(10, TimeUnit.SECONDS);

Trigger timing: A custom JSF filter intercepts each request, adds necessary metadata (e.g., UUID, alias), publishes the request via Redis, waits for the response, and returns it, effectively replacing the original remote call.

Ease of use: The tool can be added as a Spring Boot starter; beans are auto‑configured, and no manual XML configuration is required for most cases.

Implementation snippets show the Redis listener container configuration and the filter logic that performs the local invoke.

Usage documentation: After adding the spring-boot-starter-jsf-plugin dependency, configure the plugin in application.properties and define JSF provider or consumer entries with the appropriate url pointing to the target IP.

Conclusion: The JSF local debugging tool provides a lightweight, non‑intrusive solution for developers to perform local integration testing, improving development efficiency and reducing reliance on unstable test environments.

JavamiddlewareRedisSpring BootJSF
JD Tech
Written by

JD Tech

Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.