Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Hubs: make it possible to set a custom endpoint for use with TCP proxies #2147

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Feb 13, 2025

AMQP clients can choose to connect through another host, like a TCP proxy. When you do that you need to set the Host attribute in the AMQP connection.

This draft just shows how to do that, and plumbs it through the Producer.

This is how I configure the client to use it:

    let client = ProducerClient::new(
        host,
        eventhub.clone(),
        credential,
        Some(ProducerClientOptions {
            application_id: Some("test_get_properties".to_string()),
            custom_endpoint: Some("amqp://localhost:5671".to_string()),
            ..Default::default()
        }),
    );

NOTE, since it's the amqpproxy, and I don't have a proper signed cert (yet) I used plain amqp. It's only unencrypted between the code and the proxy - all outbound traffic from the proxy to the actual Event Hubs service is still TLS.

@github-actions github-actions bot added the Azure.Core The azure_core crate label Feb 13, 2025
@richardpark-msft
Copy link
Member Author

@LarryOsterman, this is the code I'm using to connect to the amqp proxy, and it matches up with what we've done in other libraries to enable it as a legitimate customer feature (you can also use it when connecting to TCP proxies). I only did it for the Producer, as a demonstration.

Also, I feel like I must have clone()'d, as_str()'d and others more than I needed to. I just based this off what I could copy/paste in your library :)

@heaths
Copy link
Member

heaths commented Feb 13, 2025

Could you shorten the title and put more of a description in here? I'm not sure what you're trying to do.

@richardpark-msft richardpark-msft changed the title Making it possible to set the custom endpoint from the outside of the… Event Hubs: make it possible to set a custom endpoint for use with TCP proxies Feb 13, 2025
@richardpark-msft
Copy link
Member Author

Could you shorten the title and put more of a description in here? I'm not sure what you're trying to do.

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core The azure_core crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants