Search in sources :

Example 1 with BatchIMapEvent

use of com.hazelcast.map.impl.querycache.event.BatchIMapEvent 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) ClientEndpoint(com.hazelcast.client.ClientEndpoint)

Example 2 with BatchIMapEvent

use of com.hazelcast.map.impl.querycache.event.BatchIMapEvent in project hazelcast by hazelcast.

the class MapEventPublishingService method dispatchBatchEventData.

private void dispatchBatchEventData(BatchEventData batchEventData, ListenerAdapter listener) {
    BatchIMapEvent mapEvent = createBatchEvent(batchEventData);
    listener.onEvent(mapEvent);
}
Also used : BatchIMapEvent(com.hazelcast.map.impl.querycache.event.BatchIMapEvent)

Example 3 with BatchIMapEvent

use of com.hazelcast.map.impl.querycache.event.BatchIMapEvent 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

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