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

Use gateway hostname from options for connection string flow #3326

Merged
merged 4 commits into from
May 4, 2023

Conversation

abhipsaMisra
Copy link
Member

The GatewayHostName set in IotHubClientOptions was being ignored for the connection string flow.
This PR updates our SDK to consider this value even when connection strings are used. If a gateway hostname is already specified in the connection string directly, then the value set through options is ignored.

@drwill-ms
Copy link
Contributor

The GatewayHostName set in IotHubClientOptions was being ignored for the connection string flow. This PR updates our SDK to consider this value even when connection strings are used. If a gateway hostname is already specified in the connection string directly, then the value set through options is ignored.

Should the connection string values override client options or the other way around?

@abhipsaMisra
Copy link
Member Author

The GatewayHostName set in IotHubClientOptions was being ignored for the connection string flow. This PR updates our SDK to consider this value even when connection strings are used. If a gateway hostname is already specified in the connection string directly, then the value set through options is ignored.

Should the connection string values override client options or the other way around?

This is the way I see it - the connection string is the most client specific argument, i.e. it is credential specific to this client instance. So, whatever value I specify in there, that should take precedence.
So, I might have a "common" options instance in my application that I might want to share across different client instances (with different identities), but the connection string I pass in will be specific to a particular client identity's instance I want to work with.

What do you think?

Copy link
Contributor

@tmahmood-microsoft tmahmood-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@abhipsaMisra
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@abhipsaMisra abhipsaMisra merged commit 23f2a60 into previews/v2 May 4, 2023
@abhipsaMisra abhipsaMisra deleted the abmisr/gateway branch May 4, 2023 21:00
@abhipsaMisra
Copy link
Member Author

I did merge this PR in already, but I synced up with David now and we're going to take it up as a parking lot item as a team for our next scrum.
We're going to persist the end resultant behavior, i.e. gateway hostname from client options should be considered even when the client is initialized using a connection string; however, the discussion is open on if the gateway hostname in the client options should take precedence over one in the connection string, or vice versa (for the case where both of them have different gateway hostnames specified).

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

Successfully merging this pull request may close these issues.

5 participants