(20241230) We no have a synchronous Kafka consumer (in 'utils_v2').

This commit is contained in:
2024-12-30 18:18:22 +05:30
parent fcc3d4b2e8
commit 51cf89a191
+23 -8
View File
@@ -6,7 +6,7 @@
DATE:
Tuesday, 24th Dec. 2024
Monday, 30th Dec. 2024
OBJECTIVE:
@@ -43,7 +43,7 @@ import os
# My utils:
from utils_v2.string import json
from utils_v2.system import files
from utils_v2.queue.kafka import ProducerKafka, create_config
from utils_v2.queue.kafka import ProducerKafka, ConsumerKafka, create_config
# To make HTTP calls:
import httpx
@@ -84,18 +84,33 @@ INSTRUMENT_LOOKUP = {}
# For Kafka:
cwd = files.get_cwd()
parent_dir = cwd
kafka_consumer = ConsumerKafka(
topic = "tickers",
config = create_config(
bootstrap_servers = "del.ditscentre.in:9092",
# buffer_memory = 3_35_54_432,
security_protocol = "SSL",
# ca_file = r"../../creds/kafka/cert_authority.pem",
# cert_file = r"../../creds/kafka/fullchain.pem",
# key_file = r"../../creds/kafka/privkey.pem"
ca_file = os.path.join(parent_dir, "creds", "kafka", "cert_authority.pem"),
cert_file = os.path.join(parent_dir, "creds", "kafka", "fullchain.pem"),
key_file = os.path.join(parent_dir, "creds", "kafka", "privkey.pem")
),
debug = False
)
kafka_producer = ProducerKafka(
topic = "tickers",
config = create_config(
bootstrap_servers = "del.ditscentre.in:9092",
# buffer_memory = 3_35_54_432,
security_protocol = "SSL",
ca_file = r"../../creds/kafka/cert_authority.pem",
cert_file = r"../../creds/kafka/fullchain.pem",
key_file = r"../../creds/kafka/privkey.pem"
# ca_file = os.path.join(parent_dir, "creds", "kafka", "cert_authority.pem"),
# cert_file = os.path.join(parent_dir, "creds", "kafka", "fullchain.pem"),
# key_file = os.path.join(parent_dir, "creds", "kafka", "privkey.pem")
# ca_file = r"../../creds/kafka/cert_authority.pem",
# cert_file = r"../../creds/kafka/fullchain.pem",
# key_file = r"../../creds/kafka/privkey.pem"
ca_file = os.path.join(parent_dir, "creds", "kafka", "cert_authority.pem"),
cert_file = os.path.join(parent_dir, "creds", "kafka", "fullchain.pem"),
key_file = os.path.join(parent_dir, "creds", "kafka", "privkey.pem")
),
debug = False
)