-
-
Save Sachin-Kottarathodi/f9dac7a3342a3643e792e2143a6adf7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gearsclient import GearsRemoteBuilder as GearsBuilder | |
from redistimeseries.client import Client | |
def stream_handler(item): | |
data = item['value'] | |
member = json.dumps( | |
{'device_id': data['device_id'], | |
'transaction_id': data['transaction_id'], | |
'ts': data['ts'], | |
}) | |
redis.Redis().zadd(data.get('device_id'), {member: data['ts']}) | |
Client().incrby(data['fraud_type'], 1) | |
GearsBuilder(reader='StreamReader', r=redis_conn, requirements=["redis", "redistimeseries"]).foreach(stream_handler).register('data_stream') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment