use of com.hazelcast.map.impl.querycache.event.SingleIMapEvent in project hazelcast by hazelcast.
the class MapAddListenerMessageTask method getEventData.
private ClientMessage getEventData(IMapEvent iMapEvent) {
if (iMapEvent instanceof SingleIMapEvent) {
QueryCacheEventData eventData = ((SingleIMapEvent) iMapEvent).getEventData();
ClientMessage clientMessage = ContinuousQueryAddListenerCodec.encodeQueryCacheSingleEvent(eventData);
int partitionId = eventData.getPartitionId();
clientMessage.setPartitionId(partitionId);
return clientMessage;
}
if (iMapEvent instanceof BatchIMapEvent) {
BatchIMapEvent batchIMapEvent = (BatchIMapEvent) iMapEvent;
BatchEventData batchEventData = batchIMapEvent.getBatchEventData();
int partitionId = batchEventData.getPartitionId();
ClientMessage clientMessage = ContinuousQueryAddListenerCodec.encodeQueryCacheBatchEvent(batchEventData.getEvents(), batchEventData.getSource(), partitionId);
clientMessage.setPartitionId(partitionId);
return clientMessage;
}
throw new IllegalArgumentException("Unexpected event type found = [" + iMapEvent + "]");
}
use of com.hazelcast.map.impl.querycache.event.SingleIMapEvent in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchQueryCacheEventData.
private void dispatchQueryCacheEventData(QueryCacheEventData eventData, ListenerAdapter listener) {
SingleIMapEvent mapEvent = createSingleIMapEvent(eventData);
listener.onEvent(mapEvent);
}
use of com.hazelcast.map.impl.querycache.event.SingleIMapEvent in project hazelcast by hazelcast.
the class SubscriberListener method onEvent.
@Override
public void onEvent(IMapEvent iMapEvent) {
if (iMapEvent instanceof SingleIMapEvent) {
QueryCacheEventData eventData = ((SingleIMapEvent) iMapEvent).getEventData();
eventData.setSerializationService(serializationService);
accumulator.accumulate(eventData);
return;
}
if (iMapEvent instanceof BatchIMapEvent) {
BatchIMapEvent batchIMapEvent = (BatchIMapEvent) iMapEvent;
BatchEventData batchEventData = batchIMapEvent.getBatchEventData();
Collection<QueryCacheEventData> events = batchEventData.getEvents();
for (QueryCacheEventData eventData : events) {
eventData.setSerializationService(serializationService);
accumulator.accumulate(eventData);
}
return;
}
}
Aggregations