CorrelatedEventsGrouper.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:streamline 作者:
/**
 * Returns the group of correlated events per source where the group of related source events
 * produces the same downstream events
 *
 * @param sources the set of source component names
 * @return the group of correlated events per source
 */
public List<Set<String>> groupByRelatedSourceEvents(Set<String> sources) {
    Multimap<Set<String>, String> allEventsToSourceEvents = LinkedHashMultimap.create();
    Stream<String> rootEventIds = events.stream().filter(e -> e != null && e.getRootIds().isEmpty())
            .map(EventInformation::getEventId);
    rootEventIds.forEach(rootEventId -> {
        Map<String, EventInformation> allRelatedEvents = buildRelatedEventsMap(rootEventId);
        allEventsToSourceEvents.put(allRelatedEvents.keySet(), rootEventId);
    });

    List<Set<String>> result = new ArrayList<>();
    allEventsToSourceEvents.asMap().values().forEach(v ->
            result.add(new HashSet<>(v))
    );

    return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号