Class LocalClient
java.lang.Object
io.fluxcapacitor.javaclient.configuration.client.AbstractClient
io.fluxcapacitor.javaclient.configuration.client.LocalClient
- All Implemented Interfaces:
Client
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
MessageType
s - 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
andFLUX_APPLICATION_ID
from environment or system properties
Usage
Typical usage involves passing this client into theFluxCapacitorBuilder
:
FluxCapacitor flux = DefaultFluxCapacitor.builder().build(LocalClient.newInstance());
-
Field Summary
Fields inherited from class io.fluxcapacitor.javaclient.configuration.client.AbstractClient
shutdownTasks
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the application ID under which this client instance is registered.protected EventStoreClient
Subclasses must implement this method to return aEventStoreClient
.protected GatewayClient
createGatewayClient
(MessageType messageType, String topic) Subclasses must implement this method to return aGatewayClient
for the given message type and topic.protected KeyValueClient
Subclasses must implement this method to return aKeyValueClient
.protected SchedulingClient
Subclasses must implement this method to return aSchedulingClient
.protected InMemorySearchStore
Subclasses must implement this method to return aSearchClient
.protected TrackingClient
createTrackingClient
(MessageType messageType, String topic) Subclasses must implement this method to return aTrackingClient
for the given message type and topic.name()
Returns the name of this client as defined in its configuration.static LocalClient
static LocalClient
newInstance
(Duration messageExpiration) Methods inherited from class io.fluxcapacitor.javaclient.configuration.client.AbstractClient
beforeShutdown, getGatewayClient, getTrackingClient, monitorDispatch, shutDown
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.javaclient.configuration.client.Client
getEventStoreClient, getGatewayClient, getKeyValueClient, getSchedulingClient, getSearchClient, getTrackingClient, id, unwrap
-
Constructor Details
-
LocalClient
-
-
Method Details
-
newInstance
-
newInstance
-
name
Description copied from interface:Client
Returns the name of this client as defined in its configuration. -
applicationId
Description copied from interface:Client
Returns the application ID under which this client instance is registered. -
createGatewayClient
Description copied from class:AbstractClient
Subclasses must implement this method to return aGatewayClient
for the given message type and topic.- Specified by:
createGatewayClient
in classAbstractClient
-
createTrackingClient
Description copied from class:AbstractClient
Subclasses must implement this method to return aTrackingClient
for the given message type and topic.- Specified by:
createTrackingClient
in classAbstractClient
-
createEventStoreClient
Description copied from class:AbstractClient
Subclasses must implement this method to return aEventStoreClient
.- Specified by:
createEventStoreClient
in classAbstractClient
-
createSchedulingClient
Description copied from class:AbstractClient
Subclasses must implement this method to return aSchedulingClient
.- Specified by:
createSchedulingClient
in classAbstractClient
-
createKeyValueClient
Description copied from class:AbstractClient
Subclasses must implement this method to return aKeyValueClient
.- Specified by:
createKeyValueClient
in classAbstractClient
-
createSearchClient
Description copied from class:AbstractClient
Subclasses must implement this method to return aSearchClient
.- Specified by:
createSearchClient
in classAbstractClient
-