Class LocalClient
java.lang.Object
io.fluxzero.sdk.configuration.client.AbstractClient
io.fluxzero.sdk.configuration.client.LocalClient
- All Implemented Interfaces:
Namespaced<Client>, 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
FLUXZERO_TASK_IDenvironment property or the JVM process name as the client ID - Reads
FLUXZERO_APPLICATION_NAMEandFLUXZERO_APPLICATION_IDfrom environment or system properties
Usage
Typical usage involves passing this client into theFluxzeroBuilder:
Fluxzero fluxzero = DefaultFluxzero.builder().build(LocalClient.newInstance());
-
Field Summary
Fields inherited from class AbstractClient
shutdownTasks -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLocalClient(Duration messageExpiration) protectedLocalClient(Duration messageExpiration, String namespace, LocalClient defaultClient) -
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(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(MessageType messageType, String topic) Subclasses must implement this method to return aTrackingClientfor the given message type and topic.forNamespace(String namespace) Creates and returns the resource scoped to the specified namespace.name()Returns the name of this client as defined in its configuration.static LocalClientstatic LocalClientnewInstance(Duration messageExpiration) Methods inherited from class AbstractClient
beforeShutdown, getGatewayClient, getTrackingClient, monitorDispatch, shutDownMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Client
getEventStoreClient, getGatewayClient, getKeyValueClient, getSchedulingClient, getSearchClient, getTrackingClient, id, namespace, unwrapMethods inherited from interface Namespaced
forDefaultNamespace
-
Constructor Details
-
LocalClient
-
LocalClient
-
-
Method Details
-
newInstance
-
newInstance
-
name
-
applicationId
-
forNamespace
Description copied from interface:NamespacedCreates and returns the resource scoped to the specified namespace.- Parameters:
namespace- the namespace to which the returned resource is scoped- Returns:
- the resource associated with the specified namespace
-
createGatewayClient
Description copied from class:AbstractClientSubclasses must implement this method to return aGatewayClientfor the given message type and topic.- Specified by:
createGatewayClientin classAbstractClient
-
createTrackingClient
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
-