Class WordCountWindowFunction

java.lang.Object
org.apache.pulsar.functions.api.examples.window.WordCountWindowFunction
All Implemented Interfaces:
org.apache.pulsar.functions.api.WindowFunction<String,Void>

public class WordCountWindowFunction extends Object implements org.apache.pulsar.functions.api.WindowFunction<String,Void>
The classic word count example done using pulsar functions Each input message is a sentence that split into words and each word counted. The built in counter state is used to keep track of the word count in a persistent and consistent manner.
  • Constructor Details

    • WordCountWindowFunction

      public WordCountWindowFunction()
  • Method Details

    • process

      public Void process(Collection<org.apache.pulsar.functions.api.Record<String>> inputs, org.apache.pulsar.functions.api.WindowContext context) throws Exception
      Specified by:
      process in interface org.apache.pulsar.functions.api.WindowFunction<String,Void>
      Throws:
      Exception