Skip to content

StreamProcessing is a collection of practical examples for learning stream processing with Java and Kafka Streams, focused on real tasks like filtering, mapping, aggregation, and event handling.

License

Notifications You must be signed in to change notification settings

arminmokri/StreamProcessing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Stream Processing

Please support this repo with your โญ

This repository provides categorized, real-world examples of stream processing using Java Streams and Kafka Streams.


Java Streams

1. Basic Stream Operations

1- Filter Even Numbers ๐Ÿ”

2- Find First Match ๐Ÿ•ต๏ธ

3- ForEach Print ๐Ÿ–จ๏ธ

4- Distinct Elements ๐Ÿ†”

5- Skip and Limit โญ๏ธ

2. Mapping & FlatMapping

1- Map to Lengths ๐Ÿ—บ๏ธ

3- Parse CSV to Object ๐Ÿ“„

4- Map to Uppercase ๐Ÿ” 

5- FlatMap Optional โ“

3. Reduction & Aggregation

1- Sum Integers โž•

2- Average Salary ๐Ÿ“Š

3- Find Max Salary ๐Ÿ†

4- Count Elements ๐Ÿ”ข

4. Collectors & Conversions

1- Collect To Map ๐Ÿ—บ๏ธ

2- Join Names ๐Ÿ”—

3- Group By Field ๐Ÿงฉ

4- Count Grouped ๐ŸŽญ

5- Collect To Set ๐Ÿงบ

5. Sorting

1- Sort by Salary ๐Ÿ’ธ

2- Multi-field Sort ๐Ÿงฎ

3- Reverse Sort ๐Ÿ”„

5- Sort Custom Objects ๐Ÿ› ๏ธ

6. Advanced Transformations

1- Filter + Map + Reduce ๐Ÿง 

2- Top N Elements ๐Ÿฅ‡

3- Nested Grouping ๐Ÿ—‚๏ธ

7. Parallel Streams

1- Parallel Sum โšก

3- Thread Safety ๐Ÿงต

8. Map Stream Operations

1- Stream over Map Entries ๐Ÿ—ƒ๏ธ

2- Sort Map by Value ๐Ÿ“‰

3- Merge Maps ๐Ÿ”€

4- Filter Map by Key ๐Ÿ”‘

5- Collect Map to List ๐Ÿ“‹

9. Primitive Streams

1- IntStream Range ๐Ÿ”ข

2- Summary Statistics ๐Ÿ“ˆ

3- Boxing/Unboxing ๐Ÿ“ฆ

4- DoubleStream Average ๐ŸŽฏ

5- LongStream Generate ๐Ÿš€

10. Exception Handling

1- Handle ParseException ๐ŸšซโŒ

2- Safe IO in Stream ๐ŸงฏโŒ

3- Wrap Checked Exceptions ๐Ÿ”โŒ

4- Log Exceptions in Stream ๐Ÿ“โŒ

5- Recover from Exceptions ๐Ÿ”„โŒ

11. Custom Collectors

1- Custom Collector for String Join ๐ŸงตโŒ

2- Collector to Summary Object ๐Ÿ“ฆโŒ

3- Collector with Downstream ๐ŸŒŠโŒ

4- Collector for Frequency Map ๐Ÿ“ŠโŒ

5- Collector for Partitioned Lists ๐ŸŽญโŒ

12. Real-World Use Cases

1- Group Books by Author ๐Ÿ“šโŒ

2- Sum Orders per Customer ๐ŸงพโŒ

3- Filter Active Users โœ…โŒ

4- Top Selling Products ๐Ÿฅ‡โŒ

5- User Login Statistics ๐Ÿ“ŠโŒ

13. Optional Handling

1- Optional from Find โ“โŒ

2- Default if Empty ๐Ÿ›ก๏ธโŒ

3- Map Optional Values ๐Ÿ”โŒ

4- Filter Optional ๐Ÿ”โŒ

5- FlatMap Optional ๐Ÿ”„โŒ

14. Debugging with Peek

1- Peek Intermediate Values ๐ŸžโŒ

2- Log in Pipeline ๐Ÿ“โŒ

3- Side Effects โš ๏ธโŒ

4- Debug with Thread Info ๐ŸงตโŒ

5- Conditional Peek ๐Ÿ”€โŒ

15. Combining Streams

1- Concat Two Streams โž•โŒ

2- Zip Two Lists ๐ŸงทโŒ

3- Merge Stream Sources ๐Ÿ”ƒโŒ

4- Intersect Streams โœจโŒ

5- Union Streams ๐Ÿ”—โŒ


Kafka Streams

1. Basics

1- Word Count Example ๐Ÿ“ŠโŒ

2- Filter and Map Kafka Records ๐Ÿ”ŽโŒ

3- Stateful Transform ๐Ÿง โŒ

4- Read from Topic ๐Ÿ“จโŒ

5- Write to Topic โœ๏ธโŒ

2. Aggregation

1- Group By Key and Count ๐ŸงฎโŒ

2- Sum Values by Window โฒ๏ธโŒ

3- Custom Aggregator โš™๏ธโŒ

4- Count Per Key ๐Ÿ“ˆโŒ

5- Aggregate to List ๐Ÿ“‹โŒ

3. Joins

1- KStream-KStream Join ๐Ÿ”€โŒ

2- KStream-Table Join ๐ŸชขโŒ

3- Windowed Joins โณโŒ

4- Left Join ๐ŸงฉโŒ

5- Outer Join ๐ŸŒโŒ

4. Windowing

1- Time Windows โŒ›โŒ

2- Sliding Windows ๐ŸŽš๏ธโŒ

3- Session Windows ๐Ÿ›‹๏ธโŒ

4- Hopping Windows ๐Ÿ”„โŒ

5- Tumbling Windows โณโŒ

5. Topology & DSL

1- Build Topology Manually ๐Ÿ—๏ธโŒ

2- DSL Word Count ๐Ÿ“–โŒ

3- Branching Streams ๐ŸŒฟโŒ

4- Transform Values ๐Ÿ”งโŒ

5- Filter Streams ๐ŸšฆโŒ

6. Real-World Use Cases

1- Transaction Monitoring ๐Ÿ’ณโŒ

2- Clickstream Analytics ๐Ÿ–ฑ๏ธโŒ

3- IoT Sensor Aggregation ๐Ÿ“กโŒ

4- User Sessionization ๐Ÿ‘คโŒ

5- Log Enrichment ๐ŸงพโŒ

About

StreamProcessing is a collection of practical examples for learning stream processing with Java and Kafka Streams, focused on real tasks like filtering, mapping, aggregation, and event handling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages