/kafka-heroku-idempotence

Test app to show problem with enabling idempotence setting when using Heroku's Kafka

Primary LanguagePythonMIT LicenseMIT

kafka-heroku-idempotence

Test app to show problem with enabling idempotence setting when using Heroku's Kafka

1) Clone the test code repo

$ git clone git@github.com:larsar/kafka-heroku-idempotence.git
Cloning into 'kafka-heroku-idempotence'...

2) Create a .env file with the Heroku Kafka environment variables

3) Create the test topic: heroku kafka:topics:create idempotence-test-topic -a APP_NAME

4) Create virtual enviroment with python 3

$ make venv
virtualenv -p python3 venv
Running virtualenv with interpreter /usr/local/bin/python3
...

5) Activate virtual environment

$ source venv/bin/activate

6) Install dependencies

$ make install
pip install -r requirements.txt
...

7) Run the test that works (the message is sent to the topic)

$ python without_idempotence_setting.py 
Done

8) Run the test that fails (the flush method hangs)

$ python with_idempotence_setting.py 
^C^C^C^C


Traceback (most recent call last):
  File "with_idempotence_setting.py", line 11, in <module>
    p.flush()
KeyboardInterrupt