You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Unified reactive client library for REST, SOAP, gRPC, GraphQL, and WebSocket services with circuit breakers and observability.
8
+
> Unified, reactive service-client library for Spring Boot — one fluent, resilient API over REST, SOAP, gRPC, GraphQL, and WebSocket with built-in circuit breakers, retries, discovery, and observability.
9
9
10
10
---
11
11
@@ -23,65 +23,76 @@
23
23
24
24
## Overview
25
25
26
-
Firefly Framework Client provides a unified, reactive communication library that supports multiple protocols through a consistent API. It includes pre-built clients for REST, SOAP, gRPC, GraphQL, and WebSocket services, each with integrated circuit breaker patterns, health monitoring, and comprehensive metrics collection.
26
+
`fireflyframework-client` is the Firefly Framework's common client library: a single, consistent, fully reactive abstraction for calling other services regardless of the wire protocol. Instead of juggling `WebClient`, JAX-WS/CXF, raw gRPC stubs, and bespoke GraphQL/WebSocket plumbing, application code uses one fluent entry point — `ServiceClient` — and gets resilience, security, discovery, and observability wired in by default.
27
27
28
-
The library features builder-based client construction (`RestClientBuilder`, `SoapClientBuilder`, `GrpcClientBuilder`), service discovery integration (Eureka, Consul, Kubernetes, static), and advanced capabilities including HTTP response caching, request deduplication, OAuth2 authentication, API key management, and certificate pinning.
28
+
The library is built on Spring WebFlux (`WebClient`) and Project Reactor, so every operation returns `Mono`/`Flux` and is non-blocking from end to end. Clients are constructed through type-safe builders (`RestClientBuilder`, `SoapClientBuilder`, `GrpcClientBuilder`) reachable from the `ServiceClient.rest(...)`, `ServiceClient.soap(...)`, and `ServiceClient.grpc(...)` static factories, and each client carries an integrated circuit breaker (Firefly's own `CircuitBreakerManager`, backed by Resilience4j), retry-with-backoff, health checks, and per-client Micrometer metrics.
29
29
30
-
Additional features include a chaos engineering interceptor for fault injection during testing, client-side rate limiting, interceptor chain support for request/response transformation, and pluggable error handling with protocol-specific error mappers.
30
+
Where it sits in the framework: this module depends only on `fireflyframework-kernel` (shared exception hierarchy and abstractions) and `fireflyframework-observability` (metrics, tracing, health, structured logging). It is the outbound-communication backbone used by Firefly microservices to consume core/domain services, third-party REST/SOAP APIs, and generated SDKs. It auto-configures itself via Spring Boot — drop it on the classpath and `ServiceClientAutoConfiguration` provides a tuned `WebClient.Builder`, a default `CircuitBreakerManager`, a default `RestClientBuilder`, a gRPC builder factory, and `ServiceClientMetrics` (when a `MeterRegistry` is present).
31
+
32
+
Beyond the core REST/SOAP/gRPC clients, the module bundles a set of companion helpers and cross-cutting concerns: a `GraphQLClientHelper` (query/mutation/batch/subscribe with response caching), a `WebSocketClientHelper` (reconnection, heartbeat, message queue), a `WebhookClientHelper` (HMAC signature generation/verification, dispatch), HTTP response caching, request deduplication, service discovery (Eureka, Consul, Kubernetes, static), client-side rate limiting, certificate pinning, API-key and OAuth2 helpers, an interceptor chain, a chaos-engineering interceptor for fault injection, and a plugin SPI for extending client behavior.
31
33
32
34
## Features
33
35
34
-
-REST, SOAP, gRPC, GraphQL, and WebSocket client implementations
35
-
-Builder pattern for type-safe client construction
36
-
-Circuit breaker with configurable sliding window and failure thresholds
-Performance: `HttpCacheManager`/`HttpCacheInterceptor` HTTP response caching and `RequestDeduplicationManager`
49
+
-Extensibility: `ServiceClientInterceptor` chain (logging, metrics, custom), `ServiceClientPlugin` SPI + `PluginManager`, and `DynamicJsonResponse` for schemaless responses
50
+
-Testing aids: `ChaosEngineeringInterceptor` for fault injection, plus a rich, mapped exception hierarchy (`ServiceTimeoutException`, `ServiceNotFoundException`, `CircuitBreakerOpenException`, `SoapFaultException`, ...) with HTTP/gRPC/SOAP error mappers
51
+
-Observability: per-client health indicators (`ServiceClientHealthIndicator`/`Manager`), Micrometer metrics (`ServiceClientMetrics`), and `MultipartUploadHelper`
52
+
- Spring Boot auto-configuration with validated `@ConfigurationProperties` and environment-aware defaults (development / testing / production)
51
53
52
54
## Requirements
53
55
54
-
- Java 21+
56
+
- Java 21+ (Java 25 recommended)
55
57
- Spring Boot 3.x
56
58
- Maven 3.9+
59
+
- A reactive (WebFlux) application context. Optional runtime dependencies only when their feature is used: a service registry (Eureka/Consul) or Kubernetes for dynamic discovery, and a reachable WSDL endpoint for SOAP clients.
57
60
58
61
## Installation
59
62
60
63
```xml
61
64
<dependency>
62
65
<groupId>org.fireflyframework</groupId>
63
66
<artifactId>fireflyframework-client</artifactId>
64
-
<version>26.02.07</version>
67
+
<!-- Version is managed by the Firefly BOM / parent; omit when inheriting it -->
65
68
</dependency>
66
69
```
67
70
71
+
If your project inherits `fireflyframework-parent` (or imports `fireflyframework-bom`), the version is managed for you and can be omitted. Otherwise pin the current release explicitly.
72
+
68
73
## Quick Start
69
74
75
+
Auto-configuration provides a default `RestClientBuilder`, `CircuitBreakerManager`, and tuned `WebClient.Builder` as soon as the dependency is on the classpath. You can use the `ServiceClient` static factories directly, or define your own client beans.
All settings live under the `firefly.service-client.*` prefix and are bound (and validated) by `ServiceClientProperties`. Properties are **global defaults** organized by protocol/concern; per-client overrides are expressed through the builders shown above. Environment-aware defaults are applied automatically based on `firefly.service-client.environment` (`development`, `testing`, `production`).
151
+
102
152
```yaml
103
153
firefly:
104
-
client:
105
-
services:
106
-
payment-service:
107
-
base-url: https://api.payments.com
108
-
connect-timeout: 5s
109
-
read-timeout: 10s
110
-
circuit-breaker:
111
-
enabled: true
112
-
failure-rate-threshold: 50
113
-
retry:
114
-
max-attempts: 3
115
-
backoff: 1s
154
+
service-client:
155
+
enabled: true # master switch for the framework
156
+
default-timeout: 30s# global default for all client operations
157
+
environment: development # development | testing | production (drives smart defaults)
158
+
default-headers: {} # headers applied to all REST clients
| `firefly.service-client.circuit-breaker.failure-rate-threshold` | `50.0` | Percentage of failures within the sliding window that opens the breaker. |
0 commit comments