forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eventhub] Custom Endpoint (Azure#24505)
* sync ce * async ce * add string ending * only pass to transport * running into same recieve issue with sync * fixing async - needs to pass to sasl * remove logger * stopping here * adding prefix to fix sample * add in prefetch * fixing transport remove print * host being overriden * removing trace * fix to use url async * aligning sync/async pattern * removing uneeded hostname switch * string formatting * changelog * adding docstrings for supported events * pr comments refactoring sync * mirroring on async * pr comment docstring * removing import * missing _ * missing ssl * if no port given, we use default set in config * async of same ^ * add default port in connection stage if port is none * adding in docstring to cliet/connection string constructor * custom_endpoint_address in client base async to match sync * fix import on websocket test * fix import 2 * skipping tests * removing import * pytest.mark
- Loading branch information
1 parent
57b529c
commit bb8fa12
Showing
12 changed files
with
136 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
sdk/eventhub/azure-eventhub/tests/pyamqp_tests/async/test_websocket_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
import pytest | ||
import asyncio | ||
import logging | ||
|
||
from azure.eventhub._pyamqp import authentication | ||
from azure.eventhub._pyamqp.aio import ReceiveClientAsync | ||
from azure.eventhub._pyamqp.constants import TransportType | ||
|
||
@pytest.mark.asyncio | ||
@pytest.mark.skip() | ||
async def test_event_hubs_client_web_socket(eventhub_config): | ||
uri = "sb://{}/{}".format(eventhub_config['hostname'], eventhub_config['event_hub']) | ||
sas_auth = SASTokenAuthAsync( | ||
uri=uri, | ||
audience=uri, | ||
username=eventhub_config['key_name'], | ||
password=eventhub_config['access_key'] | ||
) | ||
|
||
source = "amqps://{}/{}/ConsumerGroups/{}/Partitions/{}".format( | ||
eventhub_config['hostname'], | ||
eventhub_config['event_hub'], | ||
eventhub_config['consumer_group'], | ||
eventhub_config['partition']) | ||
|
||
receive_client = ReceiveClientAsync(eventhub_config['hostname'] + '/$servicebus/websocket/', source, auth=sas_auth, debug=False, timeout=5000, prefetch=50, transport_type=TransportType.AmqpOverWebsocket) | ||
await receive_client.open_async() | ||
while not await receive_client.client_ready_async(): | ||
await asyncio.sleep(0.05) | ||
messages = await receive_client.receive_message_batch_async(max_batch_size=1) | ||
logging.info(len(messages)) | ||
logging.info(messages[0]) | ||
await receive_client.close_async() |
28 changes: 28 additions & 0 deletions
28
sdk/eventhub/azure-eventhub/tests/pyamqp_tests/synctests/test_websocket.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
import pytest | ||
|
||
from azure.eventhub._pyamqp import authentication, ReceiveClient | ||
from azure.eventhub._pyamqp.constants import TransportType | ||
|
||
@pytest.mark.skip() | ||
def test_event_hubs_client_web_socket(live_eventhub): | ||
uri = "sb://{}/{}".format(live_eventhub['hostname'], live_eventhub['event_hub']) | ||
sas_auth = authentication.SASTokenAuth( | ||
uri=uri, | ||
audience=uri, | ||
username=live_eventhub['key_name'], | ||
password=live_eventhub['access_key'] | ||
) | ||
|
||
source = "amqps://{}/{}/ConsumerGroups/{}/Partitions/{}".format( | ||
live_eventhub['hostname'], | ||
live_eventhub['event_hub'], | ||
live_eventhub['consumer_group'], | ||
live_eventhub['partition']) | ||
|
||
with ReceiveClient(live_eventhub['hostname'] + '/$servicebus/websocket/', source, auth=sas_auth, debug=False, timeout=5000, prefetch=50, transport_type=TransportType.AmqpOverWebsocket) as receive_client: | ||
receive_client.receive_message_batch(max_batch_size=10) |