public interface EventService extends Consumer<Packet>, PreJoinAwareService, PostJoinAwareService
Modifier and Type | Method and Description |
---|---|
void |
close(EventRegistration eventRegistration)
Closes an EventRegistration.
|
void |
deregisterAllListeners(String serviceName,
String topic)
Deregisters all listeners belonging to the given service and topic.
|
boolean |
deregisterListener(String serviceName,
String topic,
Object id)
Deregisters a listener with the given registration ID.
|
void |
executeEventCallback(Runnable callback)
Executes an event callback on a random event thread.
|
int |
getEventQueueCapacity()
Returns the queue capacity per event thread.
|
int |
getEventQueueSize()
Returns the current total event queue size.
|
int |
getEventThreadCount()
Returns the event thread count.
|
Collection<EventRegistration> |
getRegistrations(String serviceName,
String topic)
Returns all registrations belonging to the given service and topic.
|
EventRegistration[] |
getRegistrationsAsArray(String serviceName,
String topic)
Returns all registrations belonging to the given service and topic as an array.
|
boolean |
hasEventRegistration(String serviceName,
String topic)
Returns true if a listener is registered with the specified service name and topic.
|
void |
publishEvent(String serviceName,
Collection<EventRegistration> registrations,
Object event,
int orderKey)
Publishes an event for multiple event registrations.
|
void |
publishEvent(String serviceName,
EventRegistration registration,
Object event,
int orderKey)
Publishes an event for a specific event registration.
|
void |
publishEvent(String serviceName,
String topic,
Object event,
int orderKey)
Publishes an event for all event registrations belonging to the specified service name and topic.
|
void |
publishRemoteEvent(String serviceName,
Collection<EventRegistration> registrations,
Object event,
int orderKey)
Publishes an event for multiple event registrations, excluding local ones.
|
EventRegistration |
registerListener(String serviceName,
String topic,
EventFilter filter,
Object listener)
Registers a listener on all cluster nodes with an event filter.
|
EventRegistration |
registerListener(String serviceName,
String topic,
Object listener)
Registers a listener on all cluster nodes.
|
EventRegistration |
registerLocalListener(String serviceName,
String topic,
EventFilter filter,
Object listener)
Registers a local only listener with an event filter.
|
EventRegistration |
registerLocalListener(String serviceName,
String topic,
Object listener)
Registers a local only listener.
|
getPreJoinOperation
getPostJoinOperation
int getEventThreadCount()
GroupProperty.EVENT_THREAD_COUNT
int getEventQueueCapacity()
GroupProperty.EVENT_QUEUE_CAPACITY
int getEventQueueSize()
EventRegistration registerLocalListener(@Nonnull String serviceName, @Nonnull String topic, @Nonnull Object listener)
serviceName
- service nametopic
- topic namelistener
- listener instanceIllegalArgumentException
- if the listener is null
EventRegistration registerLocalListener(@Nonnull String serviceName, @Nonnull String topic, @Nonnull EventFilter filter, @Nonnull Object listener)
serviceName
- service nametopic
- topic namefilter
- event filterlistener
- listener instanceIllegalArgumentException
- if the listener or filter is null
EventRegistration registerListener(@Nonnull String serviceName, @Nonnull String topic, @Nonnull Object listener)
serviceName
- service nametopic
- topic namelistener
- listener instanceIllegalArgumentException
- if the listener is null
EventRegistration registerListener(@Nonnull String serviceName, @Nonnull String topic, @Nonnull EventFilter filter, @Nonnull Object listener)
serviceName
- service nametopic
- topic namefilter
- event filterlistener
- listener instanceIllegalArgumentException
- if the listener or filter is null
boolean deregisterListener(@Nonnull String serviceName, @Nonnull String topic, @Nonnull Object id)
serviceName
- service nametopic
- topic nameid
- registration IDEventRegistration.getId()
,
registerListener(String, String, Object)
,
registerLocalListener(String, String, Object)
void deregisterAllListeners(@Nonnull String serviceName, @Nonnull String topic)
serviceName
- service nametopic
- topic nameCollection<EventRegistration> getRegistrations(@Nonnull String serviceName, @Nonnull String topic)
serviceName
- service nametopic
- topic nameEventRegistration[] getRegistrationsAsArray(@Nonnull String serviceName, @Nonnull String topic)
serviceName
- service nametopic
- topic nameboolean hasEventRegistration(@Nonnull String serviceName, @Nonnull String topic)
serviceName
- service nametopic
- topic namevoid publishEvent(String serviceName, String topic, Object event, int orderKey)
orderKey
are ordered, otherwise the order is not preserved.
NOTE : The order may not be preserved in case the event needs to be republished (e.g. when the registration is not on this node and the event has to be retransmitted)
serviceName
- service nametopic
- topic nameevent
- event objectorderKey
- the order key for this event. All events with the same order key are ordered.void publishEvent(String serviceName, EventRegistration registration, Object event, int orderKey)
orderKey
are ordered, otherwise the order is not preserved.
NOTE : The order may not be preserved in case the event needs to be republished (e.g. when the registration is not on this node and the event has to be retransmitted)
serviceName
- service nameregistration
- event registrationevent
- event objectorderKey
- the order key for this event. All events with the same order key are ordered.void publishEvent(String serviceName, Collection<EventRegistration> registrations, Object event, int orderKey)
orderKey
are ordered, otherwise the order is not preserved.
NOTE : The order may not be preserved in case the event needs to be republished (e.g. when the registration is not on this node and the event has to be retransmitted)
serviceName
- service nameregistrations
- multiple event registrationsevent
- event objectorderKey
- the order key for this event. All events with the same order key are ordered.void publishRemoteEvent(String serviceName, Collection<EventRegistration> registrations, Object event, int orderKey)
orderKey
are ordered, otherwise the order is not preserved.
NOTE : The order may not be preserved in case the event needs to be republished (e.g. when the registration is not on this node and the event has to be retransmitted)
serviceName
- service nameregistrations
- multiple event registrationsevent
- event objectorderKey
- the order key for this event. All events with the same order key are ordered.void executeEventCallback(@Nonnull Runnable callback)
If callback
is an instance of StripedRunnable
,
then StripedRunnable.getKey()
will be used as order key
to pick event thread.
callback
- the callback to execute on a random event threadStripedRunnable
void close(EventRegistration eventRegistration)
If the EventRegistration has any closeable resource, e.g. a listener, than this listener is closed.
eventRegistration
- the EventRegistration to close.Copyright © 2019 Hazelcast, Inc.. All rights reserved.