Skip to content

how to close async producer #291

@darionyaphet

Description

@darionyaphet

Hi
I write a simple sender script reading a file and send to kafka 0.8.1 line by line when it is send to EOF but can't exit ! Actually this script is hang on ..

producer = SimpleProducer(client, async=True,
                          req_acks=SimpleProducer.ACK_AFTER_LOCAL_WRITE,
                          ack_timeout=2000,
                          batch_send=True)

for line in open(file_name,'r').readlines():
    producer.send_messages("topic.default.2",line)

producer.stop()
client.close()

Somebody could help me ? thanks a lot ~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions