juldrixx commented on a change in pull request #5868:
URL: https://github.com/apache/nifi/pull/5868#discussion_r826930261



##########
File path: 
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/pubsub/AbstractGCPubSubProcessor.java
##########
@@ -84,4 +112,49 @@ protected ServiceOptions getServiceOptions(ProcessContext 
context, GoogleCredent
         return results;
     }
 
-}
+    protected TransportChannelProvider 
getTransportChannelProvider(ProcessContext context) {
+        final ProxyConfiguration proxyConfiguration = 
ProxyConfiguration.getConfiguration(context, () -> {
+            final String proxyHost = 
context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
+            final Integer proxyPort = 
context.getProperty(PROXY_PORT).evaluateAttributeExpressions().asInteger();
+            if (proxyHost != null && proxyPort != null && proxyPort > 0) {
+                final ProxyConfiguration componentProxyConfig = new 
ProxyConfiguration();
+                final String proxyUser = 
context.getProperty(HTTP_PROXY_USERNAME).evaluateAttributeExpressions().getValue();
+                final String proxyPassword = 
context.getProperty(HTTP_PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
+                componentProxyConfig.setProxyType(Proxy.Type.HTTP);
+                componentProxyConfig.setProxyServerHost(proxyHost);
+                componentProxyConfig.setProxyServerPort(proxyPort);
+                componentProxyConfig.setProxyUserName(proxyUser);
+                componentProxyConfig.setProxyUserPassword(proxyPassword);
+                return componentProxyConfig;
+            }
+            return ProxyConfiguration.DIRECT_CONFIGURATION;
+        });
+
+        return TopicAdminSettings.defaultGrpcTransportProviderBuilder()
+                .setChannelConfigurator(new ApiFunction<ManagedChannelBuilder, 
ManagedChannelBuilder>() {
+                    @Override
+                    public ManagedChannelBuilder apply(ManagedChannelBuilder 
managedChannelBuilder) {
+                        return managedChannelBuilder.proxyDetector(
+                                new ProxyDetector() {
+                                    @Nullable
+                                    @Override
+                                    public ProxiedSocketAddress 
proxyFor(SocketAddress socketAddress)
+                                            throws IOException {
+                                        if 
(Proxy.Type.HTTP.equals(proxyConfiguration.getProxyType()) && 
proxyConfiguration.hasCredential()) {

Review comment:
       Thanks for the feedback, I'll change it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to