use of com.hazelcast.map.impl.querycache.event.BatchEventData 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.BatchEventData in project hazelcast by hazelcast.
the class PublisherAccumulatorHandler method sendToSubscriber.
private void sendToSubscriber(Map<Integer, List<QueryCacheEventData>> map) {
Set<Map.Entry<Integer, List<QueryCacheEventData>>> entries = map.entrySet();
for (Map.Entry<Integer, List<QueryCacheEventData>> entry : entries) {
Integer partitionId = entry.getKey();
List<QueryCacheEventData> eventData = entry.getValue();
String thisNodesAddress = getThisNodesAddress();
BatchEventData batchEventData = new BatchEventData(eventData, thisNodesAddress, partitionId);
processor.process(batchEventData);
}
}
use of com.hazelcast.map.impl.querycache.event.BatchEventData 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