Skip to content

write_item not throwing exception when there is no connection  #6

@jishnug007

Description

@jishnug007

Please check the given snippet.
Exception throwing properly when no Kafka broker available in the starting stage.
But it's not throwing an exception while disconnecting the Kafka.

from time import sleep
from scrapy_kafka_export.writer import KafkaTopicWriter, \
    ScrapyKafkaTopicWriter

item_writer = ScrapyKafkaTopicWriter(
                bootstrap_servers="localhost:9092",
                topic="my-topic",
                batch_size=100,
                compression_type=None
            )
item = {}
while True:
    try:
        stats = item_writer.write_item(item)
        print(stats)
        sleep(5)
    except Exception as e:
        print(e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions