【发布时间】:2018-02-22 12:11:31
【问题描述】:
如何在 Kafka Streams API 中使用具有多重约束的 .groupby。与下面的 Java 8 Streams API 示例相同
public void twoLevelGrouping(List<Person> persons) {
final Map<String, Map<String, List<Person>>> personsByCountryAndCity = persons.stream().collect(
groupingBy(Person::getCountry,
groupingBy(Person::getCity)
)
);
System.out.println("Persons living in London: " + personsByCountryAndCity.get("UK").get("London").size());
}
【问题讨论】:
标签: java apache-kafka apache-kafka-streams