'Azure ServiceBusQueue - logging errors from uamqp
I'm using the azure-servicebus package to retrieve messages from a ServiceBusQueue - my guess is it installed uamqp as a dependency.
azure-servicebus==7.6.0uamqp==1.5.1
After my script runs, I get a ton (hundreds of lines) of the following error codes after which the process finishes with exit code 0 (=succeeds):
AttributeError: 'NoneType' object has no attribute 'debug'
Exception ignored in: 'uamqp.c_uamqp.cMessage.__dealloc__'
AttributeError: 'NoneType' object has no attribute 'debug'
AttributeError: 'NoneType' object has no attribute 'debug'
Exception ignored in: 'uamqp.c_uamqp.cMessage.__dealloc__'
AttributeError: 'NoneType' object has no attribute 'debug'
AttributeError: 'NoneType' object has no attribute 'debug'
...
Original exception was:
Error in sys.excepthook:
Original exception was:
Error in sys.excepthook:
Original exception was:
Process finished with exit code 0
It looks like the package uamqp wants to log something with the debug method, but fails to do so because the logger is not instantiated? How can I fix this? Is this something I can fix or do I need to wait for an update of the package?
My code:
from azure.servicebus import (
ServiceBusClient,
AutoLockRenewer,
ServiceBusReceivedMessage,
)
# Create connection
self.current_connection_string = connection_string
self.current_queue_name = queue_name
self.service_bus_client = ServiceBusClient.from_connection_string(
self.current_connection_string
)
self.queue_receiver = self.service_bus_client.get_queue_receiver(
self.current_queue_name, max_wait_time=max_wait_time
)
# get messages
msgs = self.queue_receiver.receive_messages(max_messages_count)
self.current_open_messages += msgs
# >>> code processing messages ommitted <<<<
# complete messages with a AutoLockRenewer in case the message lock expired in the meantime + close the queue
autolock_renewer = AutoLockRenewer()
for msg in self.current_open_messages:
autolock_renewer.register(
self.queue_receiver,
msg,
max_lock_renewal_duration=100,
)
self.queue_receiver.complete_message(msg)
self.current_open_messages = []
self.service_bus_client.close()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
