use of com.hazelcast.wan.WanMigrationAwarePublisher in project hazelcast by hazelcast.
the class WanEventContainerReplicationOperation method run.
@Override
@SuppressWarnings("unchecked")
public void run() throws Exception {
WanReplicationService service = getWanReplicationService();
int partitionId = getPartitionId();
for (WanReplicationConfig wanReplicationConfig : wanReplicationConfigs) {
service.addWanReplicationConfigLocally(wanReplicationConfig);
}
// first ensure all publishers have configuration
forAllReplicationContainers((publisher, o) -> {
});
// then ingest replication data
forAllReplicationContainers((publisher, eventContainer) -> {
if (publisher instanceof WanMigrationAwarePublisher) {
((WanMigrationAwarePublisher) publisher).processEventContainerReplicationData(partitionId, eventContainer);
}
});
}
use of com.hazelcast.wan.WanMigrationAwarePublisher in project hazelcast by hazelcast.
the class DelegatingWanScheme method prepareEventContainerReplicationData.
/**
* Collect all replication data matching the replication event and collection
* of namespaces being replicated.
* Returns containers for WAN replication events grouped by WAN publisher ID.
* Silently skips publishers not supporting replication.
*
* @param event the replication event
* @param namespaces the object namespaces which are being replicated
* @return a map from WAN publisher ID to container object for WAN replication events
*/
public Map<String, Object> prepareEventContainerReplicationData(PartitionReplicationEvent event, Collection<ServiceNamespace> namespaces) {
Map<String, Object> eventContainers = createHashMap(publishers.size());
for (Entry<String, WanPublisher> publisherEntry : publishers.entrySet()) {
WanPublisher publisher = publisherEntry.getValue();
if (publisher instanceof WanMigrationAwarePublisher) {
Object eventContainer = ((WanMigrationAwarePublisher) publisher).prepareEventContainerReplicationData(event, namespaces);
if (eventContainer != null) {
String publisherId = publisherEntry.getKey();
eventContainers.put(publisherId, eventContainer);
}
}
}
return eventContainers;
}
Aggregations