Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.07k stars 1.19k forks source link

Can the event processor host work from behind a proxy #3378

Closed vaish1707 closed 5 years ago

vaish1707 commented 5 years ago

I was trying to add cproxy in my nodejs application which is deployed into cloud foundry for the azure event hub to work behind the proxy. But unfortunately I couldn't find any code related to that in the nodejs eventprocessor . Can anyone please assist on the same on how to add proxy options while creating connection to eventhub

vaish1707 commented 5 years ago

https://github.com/Azure/azure-event-hubs-dotnet/issues/210 - a similar problem was addressed with Dotnet version of event hub client

ramya-rao-a commented 5 years ago

@vaish1707 Proxy support is not yet in place, but we are working on it.

Please see https://github.com/Azure/azure-sdk-for-js/issues/1150 which is a similar ask for Azure Service Bus.

Since Azure Service Bus and Event Hubs sdks share all the amqp related code, the proxy support will mainly be in the shared library between the 2 i.e amqp-common

Please subscribe to https://github.com/Azure/amqp-common-js/pull/29. This PR is currently blocked due to some upstream issue. Once this PR is merged, we will have a follow up PR in Service Bus as well as Event Hubs to provide proxy support.

cc @bterlson @AlexGhiondea

vaish1707 commented 5 years ago

@ramya-rao-a, I saw the PR link which you have provided. Do you have any options to attach a proxy server URL to the connection which we are making. And is the proxy applicable to eventhubclient and also the storage blob? And I should be using https Proxy in this case for both eventhubclient and storage blob. is that correct?

ramya-rao-a commented 5 years ago

Copying over the discussion from https://github.com/Azure/amqp-common-js/pull/29:

@vaish1707: @ramya-rao-a , @bterlson Does these changes also adds proxy for storage blob? We also connect to storage blob while establishing a connection to azure event hubs. In addition to this, I also have these questions. Currently I'm trying to reach azure event hub from our cloud foundry environment. All our outgoing Http calls for the application deployed in the Cloud foundry are done by supplying the proxy configuration(https://docs.run.pivotal.io/buildpacks/proxy-usage.html) to the rest client. When it comes to AMQP which is azure event hubs, until your proxy changes gets merged for azure event hubs as well, what is other alternative which we can look for?

@bterlson: @vaish1707 I believe storage should already support proxies as that service uses HTTP rather than AMQP. I'm not sure if there are docs for supporting this though. @XiaoningLiu can you help @vaish1707 find docs for supporting proxies in the storage client?

Regarding support for proxies without this change landing, I wish I had a better answer. You could use the rhea library and talk AMQP directly to service bus, perhaps, but I think that would be a lot of work.

@vaish1707: Thanks for the reply. @bterlson is there any tentative date on when amqp proxy support will be available for eventhubprocessorhost for nodejs client? Also while adding the http proxy to storage blob . Is it going to be to append to the storage blob end point?

@bterlson: @vaish1707 sorry I can't commit to a date, I'm just not sure.

Proxy support for Storage should be a matter of replacing the underlying http agent with something like http-proxy-agent. You shouldn't need to change anything else other than how the client is configured initially.

@vaish1707: @ramya-rao-a ,@bterlson until the proxy support is available for the eventprocessorhost . We tried an alternative solution to open up the firewall for the ports 5671 and 5672 over TCP . We are still facing issues evening after opening up those ports over TCP. Also for storage blob we have opened up 443 and 80 over TCP.Are we missing something here? Can you please help on this?

vaish1707 commented 5 years ago

@ramya-rao-a , @bterlson , @XiaoningLiu , @AlexGhiondea I just saw that the PR https://github.com/Azure/amqp-common-js/pull/29/ is merged. Your next step would be to update the dependency of amqp-common in https://github.com/Azure/azure-sdk-for-js/blob/master/packages/%40azure/eventhubs/client/package.json#L22 right? Once that's updated , the updated npm version will have support for proxies. Is that correct? Also once this is done, Can you please provide the documentation on how to pass proxy URL in the eventhubconnectionstring so that websockets will have the http proxy URL to connect to amqp in the amqp-common code and also can you please provide the documentation on how we pass the proxy URL to storage end point?

It would be really great if we can get a supporting documentation on how we use proxy for eventhub connection string and also storage connection string

ramya-rao-a commented 5 years ago

The PR https://github.com/Azure/azure-sdk-for-js/pull/1450 which fixes a connection related issue is also taking care of updating the version for the amqp-common dependency. We will be shipping an update with this fix very soon in the next few days.

Our next step after that would be to make the relevant changes in the event hubs library so that you can pass the proxy details, plus the documentation, just like you have described. We should have something to share by the end of the week.

Thanks for your patience

ShivangiReja commented 5 years ago

The latest release of the @azure/event-processor-host has the support for proxy. Please install the latest version and follow the sample to provide web socket and proxy information.

Do let us know how it works out, and thanks for your patience.