I'm using confluent kafka library to create a distributed system, but I'm failing to understand some principles of Kafka itself. Lets say right now I'm working with a Central, that has to listen to different customers. What i wanna do is that when the program Central is shut off, whatever customer program sends, it won't be received by the Central when I execute this program again. The way I configure it was the following:
PRODUCTOR CUSTOMER TO CENTRAL
producer_conf = {
'bootstrap.servers': f'{broker_ip}:9092',
'retries': 5,
'retry.backoff.ms': 1000
}
self.producer = Producer(producer_conf)
self.requests = self.load_requests(self.request_file)
CONSUMER CENTRAL LISTENING TO CUSTOMER:
consumer_conf = {
'bootstrap.servers': f'{broker_ip}:9092',
'group.id': 'central_group',
'auto.offset.reset': 'latest',
'enable.auto.commit': True,
}
self.consumer = Consumer(consumer_conf)
self.consumer.subscribe(['taxirequests'])
CREATION OF THE TÓPICO (manually):
bin/kafka-topics.sh --create --topic taxirequests --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
Could someone help me? Thanks a lot!