-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
21 lines (16 loc) · 857 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import threading
from kinesis_stream.consumer import KinesisConsumer
from kinesis_stream.record_queue import RecordQueueConsumer
from kinesis_stream.redis_wrapper import get_redis_conn
redis_conn = get_redis_conn(host="localhost", port=6379, db="0")
stream_name = "test-kinesis-stream"
region = "eu-west-1"
redis_state_key = "default-127.0.0.1-6379-0" # <key-host-port-db>
kinesis_consumer = KinesisConsumer(stream_name, region, redis_conn)
# kinesis_consumer.start()
record_queue_consumer = RecordQueueConsumer(stream_name, redis_conn)
# record_queue_consumer.start()
kinesis_consumer_thread = threading.Thread(name='kinesis_consumer', target=kinesis_consumer.start)
kinesis_consumer_thread.start()
record_queue_consumer_thread = threading.Thread(name='record_queue_consumer', target=record_queue_consumer.start)
record_queue_consumer_thread.start()