java.lang.Object
io.fluxcapacitor.javaclient.configuration.client.AbstractClient
io.fluxcapacitor.javaclient.configuration.client.LocalClient
All Implemented Interfaces:
Client

public class LocalClient extends AbstractClient
An in-memory Client implementation used for local development, testing, or isolated runtime environments where no connection to the Flux Platform is required.

This client simulates all major subsystems — including event storage, scheduling, key-value access, and document search — using in-memory data structures with optional message expiration. It is ideal for use cases such as:

  • Unit testing message handlers
  • Running local development instances without platform dependencies
  • Offline simulations and demos

Configuration

The default expiration time for messages and scheduled tasks is 2 minutes, but a custom duration can be specified:

 LocalClient client = LocalClient.newInstance(Duration.ofMinutes(5));
 

Features

  • Simulates gateway clients for all MessageTypes
  • Provides in-memory implementations of event store, scheduling, key-value, and search clients
  • Uses the FLUX_TASK_ID environment property or the JVM process name as the client ID
  • Reads FLUX_APPLICATION_NAME and FLUX_APPLICATION_ID from environment or system properties

Usage

Typical usage involves passing this client into the FluxCapacitorBuilder:

 FluxCapacitor flux = DefaultFluxCapacitor.builder().build(LocalClient.newInstance());