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

[Feature] [1.2.0] Add the default DWSClientConfig constructor for LinkisDataSourceRemoteClient to simplify the client API for internal microservices to call data source services #2212

Closed
2 tasks done
CCweixiao opened this issue Jun 2, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@CCweixiao
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Problem Description

为LinkisDataSourceRemoteClient增加默认的DWSClientConfig的构造方法,来简化内部微服务调用数据源服务的client API

Add the default DWSClientConfig constructor for LinkisDataSourceRemoteClient to simplify the client API for internal microservices to call data source services

Description

No response

Use case

No response

solutions

Add one method for LinkisDataSourceRemoteClient

  def createClientConfig(): DWSClientConfig = {
    val serverUrl = Configuration.getGateWayURL()
    if(StringUtils.isEmpty(serverUrl)) throw new DataSourceClientBuilderException("serverUrl cannot be null.")

    val maxConnection: Int = CONNECTION_MAX_SIZE.getValue
    val connectTimeout: Int = CONNECTION_TIMEOUT.getValue
    val readTimeout: Int = CONNECTION_READ_TIMEOUT.getValue
    val tokenKey = AUTH_TOKEN_KEY.getValue
    val tokenValue = AUTH_TOKEN_VALUE.getValue

    val authenticationStrategy: AuthenticationStrategy = new TokenAuthenticationStrategy()
    DWSClientConfigBuilder.newBuilder()
      .addServerUrl(serverUrl)
      .connectionTimeout(connectTimeout)
      .discoveryEnabled(false)
      .discoveryFrequency(1, TimeUnit.MINUTES)
      .loadbalancerEnabled(true)
      .maxConnectionSize(maxConnection)
      .retryEnabled(false)
      .readTimeout(readTimeout)
      .setAuthenticationStrategy(authenticationStrategy)
      .setAuthTokenKey(tokenKey)
      .setAuthTokenValue(tokenValue)
      .setDWSVersion(Configuration.LINKIS_WEB_VERSION.getValue)
      .build()
  }

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@CCweixiao CCweixiao added the enhancement New feature or request label Jun 2, 2022
@CCweixiao CCweixiao changed the title [Feature] [1.2.0] [Feature] [1.2.0] Add the default DWSClientConfig constructor for LinkisDataSourceRemoteClient to simplify the client API for internal microservices to call data source services Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant