-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core-amqp][event-hubs] support specifying a custom endpoint (#12909)
Fixes #12901 ### Purpose of change Some users run their applications in a private network that lacks access to public endpoints, such as <namespace>.servicebus.windows.net. Due to these restrictions, these applications are unable to create direct connections to the Azure Event Hubs service using the standard endpoint address and require the ability to specify a custom host name to ensure they route through the proper intermediary for the connection to be made. ### Testing I've added tests that verify the connection has been configured with the custom endpoint correctly. I also manually ran these changes by setting up an Application Gateway in Azure with: - backend pool with a backend target that points to the FQDN of my Event Hubs Namespace (`<namespace>.servicebus.windows.net`) - A front-end listener using a HTTPS and a nonstandard port (200). - HTTP settings with the following: - backend port: 443 - Override with new host name: set to 'Yes' - A rule that maps the front-end listener to the back-end target and uses the HTTP settings above. I then had a test script that sent events, received events, and called operations on the $management link setting the `customEndpointAddress` to the public IP address from my application gateway. Here's a simplified version of that script: ```js const { EventHubProducerClient } = require('@azure/event-hubs'); const ws = require('ws'); const connectionString = `Endpoint=sb://<namespace>.servicebus.windows.net/;SharedAccessKeyName=sakn;SharedAccessKey=key`; const eventHubName = `my-hub`; async function run() { const client = new EventHubProducerClient(connectionString, eventHubName, { customEndpointAddress: `https://my.ip.address:200`, webSocketOptions: { webSocket: ws } }); const props = await client.getEventHubProperties(); console.log(props); return client.close(); } run().catch(console.error); ``` Note that in my application gateway I also used self-signed certs so needed to do some additional work so node.js would recognize my certificate, but that's separate from the customEndpointAddress work and doesn't require changes from our SDK.
- Loading branch information
Showing
20 changed files
with
566 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.