java.lang.Object
io.fluxzero.sdk.configuration.client.AbstractClient
io.fluxzero.sdk.configuration.client.LocalClient
- All Implemented Interfaces:
Client
An in-memory
Client implementation used for local development, testing, or isolated environments where no
connection to the Fluxzero Runtime 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 Fluxzero Runtime 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_IDenvironment property or the JVM process name as the client ID - Reads
FLUX_APPLICATION_NAMEandFLUX_APPLICATION_IDfrom environment or system properties
Usage
Typical usage involves passing this client into theFluxzeroBuilder:
Fluxzero flux = DefaultFluxzero.builder().build(LocalClient.newInstance());
-
Field Summary
Fields inherited from class io.fluxzero.sdk.configuration.client.AbstractClient
shutdownTasks -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the application ID under which this client instance is registered.protected EventStoreClientSubclasses must implement this method to return aEventStoreClient.protected GatewayClientcreateGatewayClient(io.fluxzero.common.MessageType messageType, String topic) Subclasses must implement this method to return aGatewayClientfor the given message type and topic.protected KeyValueClientSubclasses must implement this method to return aKeyValueClient.protected SchedulingClientSubclasses must implement this method to return aSchedulingClient.protected InMemorySearchStoreSubclasses must implement this method to return aSearchClient.protected TrackingClientcreateTrackingClient(io.fluxzero.common.MessageType messageType, String topic) Subclasses must implement this method to return aTrackingClientfor the given message type and topic.name()Returns the name of this client as defined in its configuration.static LocalClientstatic LocalClientnewInstance(Duration messageExpiration) Methods inherited from class io.fluxzero.sdk.configuration.client.AbstractClient
beforeShutdown, getGatewayClient, getTrackingClient, monitorDispatch, shutDownMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.fluxzero.sdk.configuration.client.Client
getEventStoreClient, getGatewayClient, getKeyValueClient, getSchedulingClient, getSearchClient, getTrackingClient, id, unwrap
-
Constructor Details
-
LocalClient
-
-
Method Details
-
newInstance
-
newInstance
-
name
Description copied from interface:ClientReturns the name of this client as defined in its configuration. -
applicationId
Description copied from interface:ClientReturns the application ID under which this client instance is registered. -
createGatewayClient
protected GatewayClient createGatewayClient(io.fluxzero.common.MessageType messageType, String topic) Description copied from class:AbstractClientSubclasses must implement this method to return aGatewayClientfor the given message type and topic.- Specified by:
createGatewayClientin classAbstractClient
-
createTrackingClient
protected TrackingClient createTrackingClient(io.fluxzero.common.MessageType messageType, String topic) Description copied from class:AbstractClientSubclasses must implement this method to return aTrackingClientfor the given message type and topic.- Specified by:
createTrackingClientin classAbstractClient
-
createEventStoreClient
Description copied from class:AbstractClientSubclasses must implement this method to return aEventStoreClient.- Specified by:
createEventStoreClientin classAbstractClient
-
createSchedulingClient
Description copied from class:AbstractClientSubclasses must implement this method to return aSchedulingClient.- Specified by:
createSchedulingClientin classAbstractClient
-
createKeyValueClient
Description copied from class:AbstractClientSubclasses must implement this method to return aKeyValueClient.- Specified by:
createKeyValueClientin classAbstractClient
-
createSearchClient
Description copied from class:AbstractClientSubclasses must implement this method to return aSearchClient.- Specified by:
createSearchClientin classAbstractClient
-