Search in sources :

Example 1 with SingleIMapEvent

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 + "]");
}
Also used : BatchEventData(com.hazelcast.map.impl.querycache.event.BatchEventData) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) BatchIMapEvent(com.hazelcast.map.impl.querycache.event.BatchIMapEvent) SingleIMapEvent(com.hazelcast.map.impl.querycache.event.SingleIMapEvent) QueryCacheEventData(com.hazelcast.map.impl.querycache.event.QueryCacheEventData)

Example 2 with SingleIMapEvent

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);
}
Also used : SingleIMapEvent(com.hazelcast.map.impl.querycache.event.SingleIMapEvent)

Example 3 with SingleIMapEvent

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;
    }
}
Also used : BatchEventData(com.hazelcast.map.impl.querycache.event.BatchEventData) BatchIMapEvent(com.hazelcast.map.impl.querycache.event.BatchIMapEvent) SingleIMapEvent(com.hazelcast.map.impl.querycache.event.SingleIMapEvent) QueryCacheEventData(com.hazelcast.map.impl.querycache.event.QueryCacheEventData)

Aggregations

SingleIMapEvent (com.hazelcast.map.impl.querycache.event.SingleIMapEvent)3 BatchEventData (com.hazelcast.map.impl.querycache.event.BatchEventData)2 BatchIMapEvent (com.hazelcast.map.impl.querycache.event.BatchIMapEvent)2 QueryCacheEventData (com.hazelcast.map.impl.querycache.event.QueryCacheEventData)2 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)1