Package com.tnsai.coordination.groups
Class DefaultGroupEventBus
java.lang.Object
com.tnsai.coordination.groups.DefaultGroupEventBus
- All Implemented Interfaces:
com.tnsai.agents.groups.GroupEventBus
Default implementation of GroupEventBus.
Provides thread-safe publish-subscribe messaging with:
- Async event dispatch
- Filtered subscriptions
- Event history
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultGroupEventBus(String groupId) DefaultGroupEventBus(String groupId, int maxHistorySize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()List<com.tnsai.agents.groups.GroupEvent> getRecentEvents(int limit) List<com.tnsai.agents.groups.GroupEvent> getRecentEvents(com.tnsai.agents.groups.GroupEvent.Type type, int limit) intbooleanvoidpublish(com.tnsai.agents.groups.GroupEvent event) publishAsync(com.tnsai.agents.groups.GroupEvent event) voidstart()voidstop()subscribe(com.tnsai.agents.groups.GroupEvent.Type type, Consumer<com.tnsai.agents.groups.GroupEvent> handler) subscribe(Predicate<com.tnsai.agents.groups.GroupEvent> filter, Consumer<com.tnsai.agents.groups.GroupEvent> handler) subscribeFor(String agentId, Consumer<com.tnsai.agents.groups.GroupEvent> handler) subscribeFrom(String agentId, Consumer<com.tnsai.agents.groups.GroupEvent> handler) booleanunsubscribe(String subscriptionId) intunsubscribeAll(String agentId) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.agents.groups.GroupEventBus
publishMessage
-
Constructor Details
-
DefaultGroupEventBus
-
DefaultGroupEventBus
-
-
Method Details
-
getGroupId
- Specified by:
getGroupIdin interfacecom.tnsai.agents.groups.GroupEventBus
-
publish
public void publish(com.tnsai.agents.groups.GroupEvent event) - Specified by:
publishin interfacecom.tnsai.agents.groups.GroupEventBus
-
publishAsync
- Specified by:
publishAsyncin interfacecom.tnsai.agents.groups.GroupEventBus
-
subscribe
- Specified by:
subscribein interfacecom.tnsai.agents.groups.GroupEventBus
-
subscribe
public String subscribe(com.tnsai.agents.groups.GroupEvent.Type type, Consumer<com.tnsai.agents.groups.GroupEvent> handler) - Specified by:
subscribein interfacecom.tnsai.agents.groups.GroupEventBus
-
subscribe
public String subscribe(Predicate<com.tnsai.agents.groups.GroupEvent> filter, Consumer<com.tnsai.agents.groups.GroupEvent> handler) - Specified by:
subscribein interfacecom.tnsai.agents.groups.GroupEventBus
-
subscribeFor
- Specified by:
subscribeForin interfacecom.tnsai.agents.groups.GroupEventBus
-
subscribeFrom
- Specified by:
subscribeFromin interfacecom.tnsai.agents.groups.GroupEventBus
-
unsubscribe
- Specified by:
unsubscribein interfacecom.tnsai.agents.groups.GroupEventBus
-
unsubscribeAll
- Specified by:
unsubscribeAllin interfacecom.tnsai.agents.groups.GroupEventBus
-
getRecentEvents
- Specified by:
getRecentEventsin interfacecom.tnsai.agents.groups.GroupEventBus
-
getRecentEvents
public List<com.tnsai.agents.groups.GroupEvent> getRecentEvents(com.tnsai.agents.groups.GroupEvent.Type type, int limit) - Specified by:
getRecentEventsin interfacecom.tnsai.agents.groups.GroupEventBus
-
getSubscriptionCount
public int getSubscriptionCount()- Specified by:
getSubscriptionCountin interfacecom.tnsai.agents.groups.GroupEventBus
-
start
public void start()- Specified by:
startin interfacecom.tnsai.agents.groups.GroupEventBus
-
stop
public void stop()- Specified by:
stopin interfacecom.tnsai.agents.groups.GroupEventBus
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfacecom.tnsai.agents.groups.GroupEventBus
-
clear
public void clear()- Specified by:
clearin interfacecom.tnsai.agents.groups.GroupEventBus
-