candlerb opened a new issue #5484: Python API: create_reader() argument `reader_listener` causes exception URL: https://github.com/apache/pulsar/issues/5484 **Describe the bug** Python API describes option `reader_listener` but it causes an exception when used. **To Reproduce** Steps to reproduce the behavior: ``` import pulsar client = pulsar.Client('pulsar://localhost:6650') msg_id = pulsar.MessageId.earliest def foo(*a, **b): pass reader = client.create_reader('my-topic', msg_id, reader_listener=foo) while True: msg = reader.read_next() print("Received message %r id=%s" % (msg.data(), msg.message_id())) ``` Generates the following exception: ``` Traceback (most recent call last): File "read.py", line 9, in <module> reader = client.create_reader('my-topic', msg_id, reader_listener=foo) File "/usr/local/lib/python3.6/dist-packages/pulsar/__init__.py", line 684, in create_reader conf.reader_listener(_listener_wrapper(reader_listener, schema)) AttributeError: 'ReaderConfiguration' object has no attribute 'reader_listener' ``` **Expected behavior** To configure reader successfully **Screenshots** N/A **Desktop (please complete the following information):** N/A **Additional context** Issue separated out from #5365 `pulsar-client-cpp/python/src/config.cc` says: ``` class_<ReaderConfiguration>("ReaderConfiguration") .def("message_listener", &ReaderConfiguration_setReaderListener, return_self<>()) ``` But the python code in `pulsar-client-cpp/python/pulsar/__init__.py` calls `conf.reader_listener` instead: ``` conf = _pulsar.ReaderConfiguration() if reader_listener: conf.reader_listener(_listener_wrapper(reader_listener, schema)) ``` I suspect the former is a typo and should change to `.def("reader_listener")` (I don't have a build env setup to test this. Also, probably should have a test case adding to pick this problem up)
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
