azure-sdk-for-python: receiver.complete_message(msg) is not settling the message in Service Bus Queue

  • Package Name: azure-servicebus
  • Package Version: 7.12.2
  • Operating System: Debian GNU/Linux 12 (bookworm)
  • Python Version: 3.9

Describe the bug receiver.complete_message(msg) call is not settling the message in Service Bus Queue, instead the lock is released on the message after completion and the delivery count is incremented and it is available for pickup by next job instance. I have checked the lock_token, _lock_expired & _settled properties pre and post complete_message call, and do not see any anomaly there.

pre complete_message call value of lock_token: xxxx-xxxx-xxxx pre complete_message call value of _lock_expired: False pre complete_message call value of _settled: False

post complete_message call value of lock_token: None post complete_message call value of _lock_expired: False post complete_message call value of _settled: True

To Reproduce Steps to reproduce the behavior:

  1. Run the following code from azure.servicebus import ServiceBusClient

import os connstr = os.environ[‘SERVICE_BUS_CONNECTION_STR’] queue_name = os.environ[‘SERVICE_BUS_QUEUE_NAME’]

with ServiceBusClient.from_connection_string(connstr) as client: with client.get_queue_receiver(queue_name) as receiver: for msg in receiver: print(str(msg)) receiver.complete_message(msg)

  1. Look at the message in the queue, it still remains active and available for pickup and delivery count is incremented.

Expected behavior I expect that once the message is settled by complete_message call, it should be removed from the queue.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

With all the logs enabled I got the following error message on receiver.complete_message(msg) call.

DEBUG | azure.servicebus._pyamqp.aio._transport_async | Transport write failed: ConnectionResetError('Cannot write to closing transport') Transport write failed: ConnectionResetError('Cannot write to closing transport')