Skip to content
Back to skills

Webflux Reactive Patterns

ASecurity

Use when the complete Spring Boot 3 request path is reactive: WebFlux controllers, Reactor pipelines, R2DBC persistence, streaming, backpressure, or cancellation. For defining and registering declarative outbound API interfaces, use http-interface-clients.

  • 362 stars
  • 0 votes
  • 0 copies
  • 10 views
  • Added September 1, 2026
ai-agentsgojavareactspringtestinggitapidatabasesecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 17, 2026

npx -y skills add rrezartprebreza/spring-boot-skills --skill webflux-reactive-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Webflux Reactive Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Webflux Reactive Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/rrezartprebreza-webflux-reactive-patterns/badge)](https://www.skillsdirectory.com/skills/rrezartprebreza-webflux-reactive-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: webflux-reactive-patterns
description: >
  Use when the complete Spring Boot 3 request path is reactive: WebFlux controllers, Reactor
  pipelines, R2DBC persistence, streaming, backpressure, or cancellation. For defining and
  registering declarative outbound API interfaces, use http-interface-clients.
---

# WebFlux Reactive Patterns

Use WebFlux when the complete request path can benefit from non-blocking I/O.

## Pipeline rules

- Return `Mono` or `Flux`; do not call `subscribe()` in request-handling code.
- Compose work with `map`, `flatMap`, `concatMap`, and `zip` according to ordering requirements.
- Keep blocking JDBC, filesystem, and legacy SDK calls out of event-loop threads.
- Isolate unavoidable blocking calls on `boundedElastic` at the narrow adapter boundary.
- Apply timeouts at remote-call boundaries and preserve cancellation.

## Context and errors

- Put request-scoped metadata in Reactor `Context`, not `ThreadLocal`.
- Translate domain failures centrally without swallowing cancellation or infrastructure errors.
- Use `onErrorResume` only when a defined fallback exists.
- Avoid `onErrorContinue`; it makes partial processing hard to reason about.

## Persistence and streaming

- Use R2DBC for reactive database access; JDBC makes the pipeline blocking.
- Bound concurrency for fan-out operations.
- Define backpressure and buffering limits for streaming endpoints.
- Avoid collecting an unbounded `Flux` into memory.

## Testing

- Use `StepVerifier` for publisher behavior and `WebTestClient` for HTTP contracts.
- Test cancellation, timeout, empty results, errors, ordering, and backpressure.
- Enable blocking-call detection in tests when the project supports it.

## Examples

- See `examples/good-reactive-service.java` and `examples/bad-reactive-service.java`.

## Verification scope

The workflow fixture compiles good-reactive-service.java directly and checks found/missing
results, upstream errors, virtual-time timeout and cancellation propagation. It does not
verify a WebFlux HTTP server, R2DBC driver or reactive tenant context.
See the [coverage matrix](https://github.com/rrezartprebreza/spring-boot-skills/blob/main/verification/MATRIX.md)
for pinned versions and remaining gaps.

## Gotchas

- Agent calls `block()` in a controller or service - keep the full request path non-blocking.
- Agent calls `subscribe()` manually - the web runtime owns subscription.
- Agent stores tenant or security data in `ThreadLocal` - use Reactor `Context`.
- Agent uses unbounded `flatMap` - set concurrency according to downstream capacity.
- Agent wraps JDBC in `Mono.just` - that still blocks the caller thread.

Files in this skill

  • SKILL.md2.2 KB
  • agents/openai.yaml216 B
  • examples/bad-reactive-service.java115 B
  • examples/good-reactive-service.java705 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.