I am able to receive the message from azure queues using their official SDK. It works fine. Here is the snippet that I am using to receive a message from the queue.
from azure.servicebus import QueueClient
client = QueueClient.from_connection_string(
q_string,
q_name)
msg = None
with client.get_receiver() as queue_receiver:
messages = queue_receiver.fetch_next(max_batch_size=1, timeout=3)
if len(messages) > 0:
msg = messages[0]
print(f"Received {msg.message}")
return msg
How do I close the connection with the queue? How can I do that? Is there any function available with azure sdk?
How do I close the connection with the queue? How can I do that? Is there any function available with azure sdk?
You can call close
method on the service bus client. That will close down the Service Bus client and the underlying connection.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.