use of org.apache.samza.system.SystemAdmin in project samza by apache.
the class StreamManager method getStreamPartitionCounts.
Map<String, Integer> getStreamPartitionCounts(String systemName, Set<String> streamNames) {
Map<String, Integer> streamToPartitionCount = new HashMap<>();
SystemAdmin systemAdmin = sysAdmins.get(systemName);
if (systemAdmin == null) {
throw new SamzaException(String.format("System %s does not exist.", systemName));
}
// retrieve the metadata for the streams in this system
Map<String, SystemStreamMetadata> streamToMetadata = systemAdmin.getSystemStreamMetadata(streamNames);
// set the partitions of a stream to its StreamEdge
streamToMetadata.forEach((stream, data) -> streamToPartitionCount.put(stream, data.getSystemStreamPartitionMetadata().size()));
return streamToPartitionCount;
}
Aggregations