Class ForwardingWebConsumer

java.lang.Object
io.fluxcapacitor.javaclient.web.ForwardingWebConsumer
All Implemented Interfaces:
AutoCloseable

public class ForwardingWebConsumer extends Object implements AutoCloseable
A specialized, opt-in {web request consumer that forwards incoming MessageType.WEBREQUEST messages to a locally running HTTP server.

This class is internally initialized when FluxCapacitorBuilder.forwardWebRequestsToLocalServer(int) is configured. Rather than routing messages through Flux’s internal handler infrastructure, it converts web requests into raw HTTP requests and asynchronously sends them to http://localhost:port.

Purpose

This mechanism exists primarily for interoperability: it allows applications to integrate with their own HTTP servers (e.g., frameworks like Spring Boot, Jooby, or Vert.x) rather than adopting the Flux message-based web handler framework.

⚠️ Caution: Limited Use Case

While supported, use of this component is generally discouraged. It bypasses the core pull-based message consumption model of Flux Capacitor by pushing messages asynchronously to a local server. This introduces a risk of losing delivery guarantees, tracing consistency, and handler lifecycle control.

Consider using @HandleWeb-based handlers and declarative routing instead.

How It Works

Features

  • Header forwarding with filtering of restricted headers
  • Support for request correlation and metadata propagation
  • Graceful handling of 404s (configurable via LocalServerConfig#isIgnore404())
  • Fallback error response creation if the target server fails
See Also: