Package dev.adlin.vts4j.event
Class EventSubscriptionProvider
java.lang.Object
dev.adlin.vts4j.event.EventSubscriptionProvider
Provider responsible for managing event subscriptions by sending subscribe or
unsubscribe requests to the remote server via a request dispatcher.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull CompletableFuture<Response> sendSubscribeRequest(@NonNull Class<? extends Event> eventClass, @Nullable com.google.gson.JsonObject config, boolean subscribe) Sends an asynchronous event subscription or unsubscription request to the remote server.
-
Constructor Details
-
EventSubscriptionProvider
public EventSubscriptionProvider()
-
-
Method Details
-
sendSubscribeRequest
public @NonNull CompletableFuture<Response> sendSubscribeRequest(@NonNull Class<? extends Event> eventClass, @Nullable com.google.gson.JsonObject config, boolean subscribe) Sends an asynchronous event subscription or unsubscription request to the remote server.- Parameters:
eventClass- the class type of the event to subscribe or unsubscribe fromconfig- optional configuration payload for the event subscription, can benullsubscribe-trueto subscribe,falseto unsubscribe- Returns:
- a
CompletableFuturecontaining the server response acknowledgment - Throws:
IllegalArgumentException- if the provided event class is not registered in theEventRegistry
-