Skip to content

MultiverseLearningProducts/event-processing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Unit 3: Advanced Priority Event Processing System

Overview

This Skillable lab activity requires you to build an advanced event processing system that uses priority queues for event management and Java Streams for data processing, creating a powerful data processing pipeline.

Learning Objectives

  • Implement priority queues with custom comparators for event management
  • Build complex Stream pipelines for filtering, transformation, and aggregation
  • Integrate priority queues with Java Streams for efficient data processing
  • Optimize solutions for performance with large event volumes
  • Apply best practices for queue and stream operations

Context

You're building an event processing system that needs to:

  • Receive events with different priorities and types
  • Process events in priority order
  • Filter and transform events using Stream operations
  • Aggregate event data for reporting
  • Handle large volumes of events efficiently

Project Structure

src/main/java/com/jse/eventprocessing/
├── Event.java                 # Event data class
├── EventType.java             # Event type enum
├── EventPriority.java         # Event priority enum
├── EventProcessor.java        # Main processing class
└── EventReport.java           # Report data class

src/test/java/com/jse/eventprocessing/
└── EventProcessorTest.java    # Test cases

Requirements

1. Event Data Structure

  • Create Event class with: type, priority, timestamp, data, source
  • Implement EventType enum (ORDER, PAYMENT, SHIPMENT, etc.)
  • Implement EventPriority enum (HIGH, MEDIUM, LOW)
  • Include proper equals, hashCode, and toString methods

2. Priority Queue Implementation

  • Use PriorityQueue with custom comparator
  • Order by priority first (HIGH > MEDIUM > LOW)
  • Then by timestamp (earlier events first)
  • Handle priority ties appropriately

3. Stream Pipeline for Filtering

  • Filter events by type
  • Filter events by priority
  • Filter events by time range
  • Combine multiple filters

4. Stream Transformations

  • Map events to different data structures
  • Extract specific fields
  • Transform event data format
  • Use flatMap for nested structures

5. Stream Aggregation

  • Group events by type
  • Group events by priority
  • Count events by category
  • Calculate statistics (sum, average, etc.)
  • Partition events based on criteria

6. Queue-Stream Integration

  • Convert priority queue to stream
  • Process queue contents with streams
  • Maintain priority awareness
  • Collect results efficiently

7. Performance Optimization

  • Batch processing for large volumes
  • Efficient terminal operations
  • Lazy evaluation utilization
  • Memory management

Implementation Steps

  1. Design system architecture - Plan event structure and processing flow
  2. Implement priority queue - Create queue with custom comparator
  3. Build Stream filtering - Create pipelines for event filtering
  4. Implement transformations - Add mapping and transformation operations
  5. Add aggregation - Implement grouping, partitioning, and statistics
  6. Integrate queues and streams - Combine both approaches
  7. Optimize performance - Apply optimization techniques
  8. Test and validate - Run tests and performance benchmarks

Testing

Run the provided test cases:

mvn test

Resources

  • Event processing framework provided
  • Event dataset with priorities and complex structure
  • Processing requirements document
  • Performance benchmarks
  • Test cases for validation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages