A simple word count program built with ZIO and Apache Beam/Scio that demonstrates retry logic and error handling.
- Counts words in a text file using Apache Beam
- Built with ZIO for functional effect management
- Includes retry logic with fixed delays
- Simulates random failures for testing resilience
sbt "runMain beam.WordCountZIO --output=wc-output"Run the WordCountZIO object directly with program arguments: --output=wc-output
--input=<path>- Input file path (defaults tosrc/main/resources/kinglear.txt)--output=<path>- Output directory (defaults towc-output)--runner=DirectRunner- Beam runner (optional, DirectRunner is default)
The program:
- Generates a random number and fails 90% of the time to demonstrate retry logic
- Retries up to 10 times with 1-second fixed delays
- Processes the input text file and counts word occurrences
- Outputs results to numbered part files in the specified directory
Results are written as text files in the output directory with format: word: count