Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.63k stars 2.84k forks source link

Python service bus client with custom_endpoint_address always uses AmqpOverWebsocket #38515

Closed jvanegmond closed 1 day ago

jvanegmond commented 1 week ago

Describe the bug When using ServiceBusClient and specifying both a custom_endpoint_address and transport_type = TransportType.Amqp, the actual connection is made with TransportType.AmqpOverWebsocket instead.

To Reproduce

with ServiceBusClient.from_connection_string(
    conn_str="Endpoint=sb://localenvironment.local;SharedAccessKeyName=1234;SharedAccessKey=password",
    custom_endpoint_address="https://localhost:5672",
    transport_type=TransportType.Amqp,
) as client:
    print(client._config.transport_type) # Prints TransportType.AmqpOverWebsocket

On the server side, the following packet is received:

Upgrade: websocket
Host: localhost:5672
Origin: https://localhost:5672
Sec-WebSocket-Key: .....
Sec-WebSocket-Version: 13
Connection: Upgrade
Sec-WebSocket-Protocol: AMQPWSB10

Expected behavior The service bus client connects using Amqp as specified by the transport_type parameter.

Additional context When using a local Amqp 1.0 emulator, I want to use a custom_endpoint_address along with transport_type = TransportType.Amqp.

The relevant code behavior is in configuration.py:#L62 but it is unknown why this is being done and is not further documented.

github-actions[bot] commented 1 week ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

kashifkhan commented 1 week ago

Thank you for the feedback @jvanegmond . We will investigate and get back to you asap.

l0lawrence commented 1 day ago

Hi @jvanegmond we merged a pr to add custom endpoint support over Amqp, when TransportType.Amqp is specified. We don't release packages during the month of December, but if you want to test out these changes you can build a wheel off of the main branch. We will update this thread when the fix is released.

github-actions[bot] commented 1 day ago

Hi @jvanegmond. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

jvanegmond commented 1 day ago

I have tested the changes and can verify it works as expected. Thanks for the quick turnaround.