getsentry / arroyo

A library to build streaming applications that consume from and produce to Kafka.
https://getsentry.github.io/arroyo/
Apache License 2.0
39 stars 6 forks source link

Errors following Getting Started With Arroyo #353

Closed mwarkentin closed 2 months ago

mwarkentin commented 2 months ago

Steps to Reproduce

Working through the Getting Started With Arroyo tutorial. My code is available here. Specifically this change.

Expected Result

I thought the consumer would work and start publishing messages to the dest-topic.

Actual Result

When I reached the last step, I received the following error:

AttributeError: 'Message' object has no attribute 'key'
Traceback (most recent call last):
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/src/streaming_consumer.py", line 75, in <module>
    processor.run()
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/processing/processor.py", line 322, in run
    self._run_once()
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/processing/processor.py", line 410, in _run_once
    self.__processing_strategy.submit(message)
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/processing/strategies/guard.py", line 82, in submit
    self.__inner_strategy.submit(message)
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/processing/strategies/run_task.py", line 52, in submit
    self.__next_step.submit(Message(value))
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/processing/strategies/guard.py", line 34, in submit
    self.__next_step.submit(message)
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/processing/strategies/produce.py", line 95, in submit
    future = self.__producer.produce(self.__topic, message.payload)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mwarkentin/repos/sentry/arroyo-sandbox/.venv/lib/python3.12/site-packages/arroyo/backends/kafka/consumer.py", line 705, in produce
    key=payload.key,
        ^^^^^^^^^^^
AttributeError: 'Message' object has no attribute 'key'

It's not clear to me if I messed something up or if the tutorial is out of date with how Arroyo works today.

One suggestion might be to provide a working set of code for each stage of this tutorial in the arroyo examples directory.