This project processes a list of events using Sidekiq for background job processing. It identifies accounts with reactivations and multiple cancellations.
-
Clone git Repo.:
git@github.com:sajjadmurtaza/event_processor.git
-
Install Redis: Sidekiq requires Redis to manage job queues. Ensure Redis is installed and running.
-
Install Bundler: If you haven't already, install Bundler:
gem install bundler
-
Install Dependencies: Run Bundler to install the necessary gems:
bundle install
- Start Redis: Ensure Redis is running. You can start it with:
bundle install
- Start Sidekiq: Run the following command to start Sidekiq:
bundle exec sidekiq -r ./main.rb -C sidekiq_config.yml
- Rub Tests:
bundle exec rspec
- Future Growth: While the current task is simple, using Sidekiq prepares the system for future scalability.
- Asynchronous Processing
- Entry point for the application. Loads events and enqueues them for processing with Sidekiq.
EventProcessor
- Processes events to identify accounts with reactivations and multiple cancellations.
EventProcessorLogger
- Provides a logger for consistent logging throughout the application.
DataLoader
- Loads events from a JSON file into a Ruby data structure.
Aggregator
- Reads and displays aggregated results from the results file.
EventWorker
- Sidekiq worker that processes events in the background and writes results to a file.