Sidekiq Worker Strategies
Description
This project contains various types of strategies that handle communication between the accounts-cc and worker-cc.
Polling strategy
This strategy is a simple algorithm that basically follow these simple steps:
- Load account and transaction information.
- Establish connection with request and reply tubes.
- Validate if the account is in a valid state.
- Validate if there are available watchers (workers ready to process the job).
- Validate if the provider is available (pending implementation).
- Search for data in reply tube in case that previously a worker has processed the job.
- Search for an existing request job in buried state and put it back in the ready queue.
- Put a new request job if steps 6 and 7 are not meet and start polling on request tube to obatin a reply job.
- Process the reply job.
This strategy needs to be included on accounts-cc to see in the real world how it works, the only necessary files are:
- lib/account_handler.rb
- lib/beanstalk_handler.rb
- polling_strategy.rb
NOTES:
- models.rb and models/* are like mocks used to run this strategy stand-alone.
- lines commented with double '#' indicates that are lines that should be uncommented in accounts-cc
- lines that have 'TODO: remove' indicates that are lines that should be commented or deleted on accounts-cc
SPECS
Pending