You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/06/08 01:46:41 UTC
[GitHub] rdhabalia commented on a change in pull request #1935: Add Client
auth plugin and tls support for function to connect with broker
rdhabalia commented on a change in pull request #1935: Add Client auth plugin and tls support for function to connect with broker
URL: https://github.com/apache/incubator-pulsar/pull/1935#discussion_r193933987
##########
File path: pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/ThreadRuntimeFactory.java
##########
@@ -41,26 +45,37 @@
private final String storageServiceUrl;
private volatile boolean closed;
- public ThreadRuntimeFactory(String threadGroupName,
- String pulsarServiceUrl,
- String storageServiceUrl)
- throws Exception {
- this(
- threadGroupName,
- pulsarServiceUrl != null ? PulsarClient.builder().serviceUrl(pulsarServiceUrl).build() : null,
- storageServiceUrl);
+ public ThreadRuntimeFactory(String threadGroupName, String pulsarServiceUrl, String storageServiceUrl,
+ String clientAuthenticationPlugin, String clientAuthenticationParameters, boolean useTls,
+ boolean tlsAllowInsecureConnection) throws Exception {
+ this(threadGroupName, createPulsarClient(pulsarServiceUrl, clientAuthenticationPlugin,
+ clientAuthenticationParameters, useTls, tlsAllowInsecureConnection), storageServiceUrl);
}
@VisibleForTesting
- ThreadRuntimeFactory(String threadGroupName,
- PulsarClient pulsarClient,
- String storageServiceUrl) {
+ ThreadRuntimeFactory(String threadGroupName, PulsarClient pulsarClient, String storageServiceUrl) {
this.fnCache = new FunctionCacheManagerImpl();
this.threadGroup = new ThreadGroup(threadGroupName);
this.pulsarClient = pulsarClient;
this.storageServiceUrl = storageServiceUrl;
}
+ private static PulsarClient createPulsarClient(String pulsarServiceUrl, String clientAuthenticationPlugin,
+ String clientAuthenticationParameters, boolean useTls, boolean tlsAllowInsecureConnection)
+ throws PulsarClientException {
+ ClientBuilder clientBuilder = null;
+ if (isNotBlank(pulsarServiceUrl)) {
+ clientBuilder = PulsarClient.builder().serviceUrl(pulsarServiceUrl);
+ if (isNotBlank(clientAuthenticationPlugin) && isNotBlank(clientAuthenticationParameters)) {
+ clientBuilder.authentication(clientAuthenticationPlugin, clientAuthenticationParameters);
+ clientBuilder.enableTls(useTls);
Review comment:
fixed it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services