Repository navigation
Closed
Labels
type/bugThe PR fixed a bug or issue reported a bug
Description
Describe the bug
Python client does not accept receiver queue size equal to 0, but according to documentation:
If you’d like to have tight control over message dispatching across consumers, set the consumers’ receiver queue size very low (potentially even to 0 if necessary).
while other clients (e.g. C++ and Java clients) accept receiver queue size equal to 0 and work according to documentation.
To Reproduce
Steps to reproduce the behavior:
- Run the following Python code:
#!/usr/bin/env python3
import sys
import pulsar
client = pulsar.Client('pulsar://localhost:6650')
consumer = client.subscribe('abcd', subscription_name='xyz',
consumer_type=pulsar.ConsumerType.Shared,
receiver_queue_size=0)
msg = consumer.receive()
print("Received message: %s" % msg.data(), flush=True)
consumer.acknowledge(msg)
client.close()- See error
Expected behavior
Python client consumer API ( client.subscribe) should accept parameter receiver_queue_size=0 as described in documentation and as function correctly for other clients (C++, Java).
Screenshots
2019-11-12 15:11:57.331 INFO Client:88 | Subscribing on Topic :abcd
2019-11-12 15:11:57.331 INFO ConnectionPool:72 | Created connection for pulsar://localhost:6650
2019-11-12 15:11:57.333 INFO ClientConnection:324 | [[::1]:51100 -> [::1]:6650] Connected to broker
2019-11-12 15:11:57.398 INFO HandlerBase:52 | [persistent://public/default/abcd, xyz, 0] Getting connection from pool
2019-11-12 15:11:57.423 INFO ConnectionPool:72 | Created connection for pulsar://cfc0ca6995fc:6650
2019-11-12 15:11:57.424 INFO ClientConnection:326 | [[::1]:51101 -> [::1]:6650] Connected to broker through proxy. Logical broker: pulsar://cfc0ca6995fc:6650
2019-11-12 15:11:57.684 INFO ConsumerImpl:170 | [persistent://public/default/abcd, xyz, 0] Created consumer on broker [[::1]:51101 -> [::1]:6650]
2019-11-12 15:11:57.684 WARN ConsumerImpl:631 | [persistent://public/default/abcd, xyz, 0] Can't use this function if the queue size is 0
Traceback (most recent call last):
File "tst.py", line 10, in <module>
msg = consumer.receive()
File "/python3.7/site-packages/pulsar/__init__.py", line 930, in receive
msg = self._consumer.receive()
Exception: Pulsar error: InvalidConfigurationDesktop (please complete the following information):
- OS: macOS Catalina (v: 10.15.1)
Metadata
Metadata
Assignees
Labels
type/bugThe PR fixed a bug or issue reported a bug
Activity
jiazhai commentedon Nov 14, 2019
In Cpp,
ConsumerImpl::receive(Message& msg)supportsreceiver_queue_size=0.but with
timeoutparameter,ConsumerImpl::receive(Message& msg, int timeout)not support.But in python, the methods both with and without
timeoutparameter, finally calls intoConsumerImpl::receive(Message& msg, int timeout).jiazhai commentedon Nov 14, 2019
@tuteng Not sure why python not call
consumer.receive(msg)directly. Would you please help to take a look?Fix consumer of python queue size is zero (#5706)
Fix consumer of python queue size is zero (#5706)