[UB1-913] Event Listener Async
Adds:
- Configuration file reading
- Event queue and Event Processor on a background thread
- Closing at sysexit with graceful shutdown (process anything left in the queue before exit)
- Call add event at enc/dec
Processor is handled as part of Creds so it's invisible to the user. No code change on their end basically.
As long as they use the same creds object, the event processor hitches a ride. Calling creds.addEvent
is a little weird, but it makes sense, creds is used in all parts of the lifecycle and can forward on (with the added bonus of the creds object managed the api key etc).
Added logging.verbose
to the config file cause... why not? Made debugging this a lot easier.
➜ examples git:(UB1-913-event_listener_async) ✗ pipenv run python3 ubiq_fpe_sample.py -e "123-45-6789" -P DEV -n SSN
ENCRYPTED cipher= 100-14-NQpr
Closing event processor
Processing 1 events
Processed events: {"usage": [{"api_key": "nxKnkh9UuzCDrbpptm0JTzKV", "dataset_name": "SSN", "dataset_group_name": "", "billing_action": "encrypt", "dataset_type": "structured", "key_number": "1", "count": 1}]}