I am using Kafka 2.12 and kafka-python module as Kafka client. I am trying to test a simple producer:
class Producer(Process):
daemon = True
def run(self):
producer = KafkaProducer(bootstrap_servers='kafka:9092')
print("Sending messages...")
producer.send('topic', json.dumps(message).encode('utf-8'))
When this process is instantiated, the message is never received by the consumer
If I flush the producer and change linger_ms param (making it sync), the message is sent and read by the consumer:
class Producer(Process):
daemon = True
def run(self):
producer = KafkaProducer(bootstrap_servers='kafka:9092', linger_ms=10)
print("Sending messages...")
producer.send('topic', json.dumps(message).encode('utf-8'))
producer.flush()
In previous Kafka versions, there was the param queue.buffering.max.ms to specify how long the producer will wait until send the messages in the queue, but it is not present in the latest version (kafka-python 1.3.3). How could I specify this in newer Kafka versions to keep my comm asyncronous?
Thanks!