use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class CollectionOperation method publishEvent.
protected void publishEvent(ItemEventType eventType, Data data) {
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(getServiceName(), name);
final Address address = getNodeEngine().getThisAddress();
for (EventRegistration registration : registrations) {
CollectionEventFilter filter = (CollectionEventFilter) registration.getFilter();
final boolean includeValue = filter.isIncludeValue();
CollectionEvent event = new CollectionEvent(name, includeValue ? data : null, eventType, address);
eventService.publishEvent(getServiceName(), registration, event, name.hashCode());
}
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class QueueOperation method publishEvent.
public void publishEvent(ItemEventType eventType, Data data) {
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(getServiceName(), name);
Address thisAddress = getNodeEngine().getThisAddress();
for (EventRegistration registration : registrations) {
QueueEventFilter filter = (QueueEventFilter) registration.getFilter();
QueueEvent event = new QueueEvent(name, filter.isIncludeValue() ? data : null, eventType, thisAddress);
eventService.publishEvent(getServiceName(), registration, event, name.hashCode());
}
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class QueueOperation method hasListener.
public boolean hasListener() {
EventService eventService = getNodeEngine().getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(getServiceName(), name);
return registrations.size() > 0;
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class AddCPGroupAvailabilityListenerMessageTask method processInternal.
@Override
protected CompletableFuture<UUID> processInternal() {
EventService eventService = clientEngine.getEventService();
CPGroupAvailabilityListener listener = new ClientCPGroupAvailabilityListener(endpoint);
boolean local = parameters;
if (local) {
UUID id = eventService.registerLocalListener(getServiceName(), TOPIC, listener).getId();
return CompletableFuture.completedFuture(id);
}
return eventService.registerListenerAsync(getServiceName(), TOPIC, listener).thenApplyAsync(EventRegistration::getId, CALLER_RUNS);
}
use of com.hazelcast.spi.impl.eventservice.EventRegistration in project hazelcast by hazelcast.
the class AddCPMembershipListenerMessageTask method processInternal.
@Override
protected CompletableFuture<UUID> processInternal() {
EventService eventService = clientEngine.getEventService();
CPMembershipListener listener = new ClientCPMembershipListener(endpoint);
boolean local = parameters;
if (local) {
UUID id = eventService.registerLocalListener(getServiceName(), TOPIC, listener).getId();
return CompletableFuture.completedFuture(id);
}
return eventService.registerListenerAsync(getServiceName(), TOPIC, listener).thenApplyAsync(EventRegistration::getId, CALLER_RUNS);
}
Aggregations