david-streamlio opened a new issue #11448:
URL: https://github.com/apache/pulsar/issues/11448
**Describe the bug**
Messages sent using the Python client, 2.6.3 that specify a value in the
deliver_after parameter are delivered immediately to any attached consumer.
**To Reproduce**
Steps to reproduce the behavior:
1. Start a consumer in a separate thread that is consuming from a topic
2. Run the code below to publish messages to the same topic
3. Observe that the consumer immediate processes the messages that were
supposed to be delayed.
**Expected behavior**
The messages that were sent were supposed to be delivered at a later point
in time.
**Screenshots**
**Desktop (please complete the following information):**
- OS: MacBook Pro
- Python3.8
- Pulsar-client 2.6.3 (anything higher doesn't work)
**Additional context**
== = Consumer code =====
client = pulsar.Client('pulsar://localhost:6650')
consumer = client.subscribe(
'persistent://public/default/my-topic',
'my-subscription',
consumer_type=pulsar.ConsumerType.Exclusive,
initial_position=pulsar.InitialPosition.Latest,
message_listener=None,
negative_ack_redelivery_delay_ms=60000)
while True:
msg = consumer.receive()
try:
print("Received message '%s' id='%s'", msg.data().decode('utf-8'),
msg.message_id())
if msg.properties() is not None:
print(msg.properties())
consumer.acknowledge(msg)
except:
consumer.negative_acknowledge(msg)
client.close()
=== Producer code =====
client = pulsar.Client('pulsar://localhost:6650')
producer = client.create_producer(
'persistent://public/default/my-topic',
producer_name='delayed-python-producer')
for i in range(10):
producer.send(
('Hello-in-the-future-%d' % i).encode('utf-8'),
properties={"key1": "delayed-5-hours"},
deliver_after=timedelta(hours=5))
client.close()
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]