Class WebSocketClient
java.lang.Object
io.fluxzero.sdk.common.AbstractNamespaced<Client>
io.fluxzero.sdk.configuration.client.AbstractClient
io.fluxzero.sdk.configuration.client.WebSocketClient
- All Implemented Interfaces:
Namespaced<Client>, Client
A
Client implementation that connects to the Fluxzero Runtime using WebSocket connections.
This client enables full integration with the Fluxzero Runtime by delegating all gateway, tracking, and subsystem
communication to remote endpoints defined by the WebSocketClient.ClientConfig. It is typically used in production and testing
environments where communication with the Fluxzero Runtime is required.
Usage
WebSocketClient client = WebSocketClient.newInstance(
WebSocketClient.ClientConfig.builder()
.runtimeBaseUrl("wss://my.fluxzero.host")
.name("my-service")
.build());
Fluxzero fluxzero = Fluxzero.builder().build(client);
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration class for creating aWebSocketClient.static classConfiguration for a tracking client assigned to a specificMessageType. -
Field Summary
Fields inherited from class AbstractClient
shutdownTasks -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWebSocketClient(WebSocketClient.ClientConfig clientConfig, WebSocketClient applicationClient) -
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 ClientcreateForNamespace(String namespace) 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 SearchClientSubclasses 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.Returns a sorted, duplicate-free snapshot of namespaces in this client's storage environment.id()Returns the unique identifier of this client instance.booleanWhether this client or its owning application has started controlled shutdown.name()Returns the name of this client as defined in its configuration.Returns the namespace associated with this client instance.static WebSocketClientnewInstance(WebSocketClient.ClientConfig clientConfig) Creates a WebSocket client using the supplied connection configuration.voidAnnounces controlled shutdown before application callbacks and consumers drain.voidshutDown()Shuts down this client instance, releasing any underlying resources.Methods inherited from class AbstractClient
beforeShutdown, getGatewayClient, getTrackingClient, knownNamespaces, monitorDispatch, registerNamespaceClientMethods inherited from class AbstractNamespaced
close, forNamespaceMethods 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, unwrapMethods inherited from interface Namespaced
forApplicationNamespace, forDefaultNamespace, forNamespace
-
Constructor Details
-
WebSocketClient
protected WebSocketClient(WebSocketClient.ClientConfig clientConfig, WebSocketClient applicationClient)
-
-
Method Details
-
newInstance
Creates a WebSocket client using the supplied connection configuration. -
prepareShutdown
public void prepareShutdown()Description copied from interface:ClientAnnounces controlled shutdown before application callbacks and consumers drain. Implementations may stop liveness monitoring, but must keep transport and other resources available untilClient.shutDown(). Repeated calls must be harmless. The default implementation does nothing. -
isShuttingDown
public boolean isShuttingDown()Whether this client or its owning application has started controlled shutdown. -
getNamespaces
Description copied from interface:ClientReturns a sorted, duplicate-free snapshot of namespaces in this client's storage environment. The Runtime includes persisted namespaces without active clients. Local clients include namespaces created within the same root client; independent local clients remain isolated. Discovery does not create namespaces. This Runtime-wide operation requires a server and deployment route supporting namespace discovery. Custom clients that do not implement discovery fail explicitly instead of returning a partial list. -
shutDown
public void shutDown()Description copied from interface:ClientShuts down this client instance, releasing any underlying resources.This includes closing websocket sessions, stopping tracking, and executing registered shutdown hooks.
- Specified by:
shutDownin interfaceClient- Overrides:
shutDownin classAbstractClient
-
name
-
id
-
applicationId
-
namespace
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<Client>
-
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
-