Package com.slack.api

Class SlackConfig

java.lang.Object
com.slack.api.SlackConfig
All Implemented Interfaces:
AutoCloseable

public class SlackConfig extends Object implements AutoCloseable
The basic configuration of this SDK. Some settings can be propagated to submodules such as Bolt.

Please note that, if you are fine with the same settings for all Slack instances across an application, using a singleton instance of this config class is highly recommended. Also, a Slack instance is thread-safe, so you can use singleton for it too.

If you create a new SlackConfig instance for each Slack instance creation, each SlackConfig object can create thread pools for maintaining metrics data and async executions. In most use cases, this should not be intended. To avoid this, consider reusing SlackConfig objects as much as possible.

An alternative way is to set the statsEnabled flag to false. As long as you don't use the metrics and async API calls at all, there is no downside by doing so.

  • Field Details

    • DEFAULT

      public static final SlackConfig DEFAULT
      The default instance is immutable. It's not allowed to modify the value runtime for any reasons.
  • Constructor Details

    • SlackConfig

      public SlackConfig()
  • Method Details

    • setLibraryMaintainerMode

      public void setLibraryMaintainerMode(boolean libraryMaintainerMode)
    • setRateLimiterBackgroundJobIntervalMillis

      public void setRateLimiterBackgroundJobIntervalMillis(Long rateLimiterBackgroundJobIntervalMillis)
    • setStatsEnabled

      public void setStatsEnabled(boolean statsEnabled)
    • synchronizeMetricsDatabases

      public void synchronizeMetricsDatabases()
    • synchronizeExecutorServiceProviders

      public void synchronizeExecutorServiceProviders()
    • synchronizeLibraryMaintainerMode

      public void synchronizeLibraryMaintainerMode()
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • getHttpClientReadTimeoutMillis

      public Integer getHttpClientReadTimeoutMillis()
      The underlying HTTP client's read timeout (in milliseconds). The default is 10 seconds. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/read-timeout-millis/
    • getHttpClientWriteTimeoutMillis

      public Integer getHttpClientWriteTimeoutMillis()
      The underlying HTTP client's write timeout (in milliseconds). The default is 10 seconds. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/write-timeout-millis/
    • getHttpClientCallTimeoutMillis

      public Integer getHttpClientCallTimeoutMillis()
      The underlying HTTP client's call timeout (in milliseconds). By default, there is no timeout for complete calls while there is for connect/write/read actions within a call. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/call-timeout-millis/
    • getProxyUrl

      public String getProxyUrl()
      The proxy server URL supposed to be used for all api calls.
    • getProxyHeaders

      public Map<String,String> getProxyHeaders()
      Additional headers for proxy (e.g., Proxy-Authorization)
    • isPrettyResponseLoggingEnabled

      public boolean isPrettyResponseLoggingEnabled()
    • isLibraryMaintainerMode

      public boolean isLibraryMaintainerMode()
      Don't enable this flag in production. This flag enables some validation features for development.
    • isFailOnUnknownProperties

      public boolean isFailOnUnknownProperties()
      If you would like to detect unknown properties by throwing exceptions, set this flag as true.
    • isTokenExistenceVerificationEnabled

      public boolean isTokenExistenceVerificationEnabled()
      Slack Web API client verifies the existence of tokens before sending HTTP requests to Slack servers.
    • getHttpClientResponseHandlers

      public List<HttpResponseListener> getHttpClientResponseHandlers()
    • getAuditEndpointUrlPrefix

      public String getAuditEndpointUrlPrefix()
    • getMethodsEndpointUrlPrefix

      public String getMethodsEndpointUrlPrefix()
    • getScimEndpointUrlPrefix

      public String getScimEndpointUrlPrefix()
    • getScim2EndpointUrlPrefix

      public String getScim2EndpointUrlPrefix()
    • getStatusEndpointUrlPrefix

      public String getStatusEndpointUrlPrefix()
    • getLegacyStatusEndpointUrlPrefix

      public String getLegacyStatusEndpointUrlPrefix()
    • getExecutorServiceProvider

      public ExecutorServiceProvider getExecutorServiceProvider()
    • getRateLimiterBackgroundJobIntervalMillis

      public Long getRateLimiterBackgroundJobIntervalMillis()
    • isStatsEnabled

      public boolean isStatsEnabled()
    • getMethodsConfig

      public MethodsConfig getMethodsConfig()
    • getAuditConfig

      public AuditConfig getAuditConfig()
    • getSCIMConfig

      public SCIMConfig getSCIMConfig()
    • getSCIM2Config

      public SCIM2Config getSCIM2Config()
    • setHttpClientReadTimeoutMillis

      public void setHttpClientReadTimeoutMillis(Integer httpClientReadTimeoutMillis)
      The underlying HTTP client's read timeout (in milliseconds). The default is 10 seconds. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/read-timeout-millis/
    • setHttpClientWriteTimeoutMillis

      public void setHttpClientWriteTimeoutMillis(Integer httpClientWriteTimeoutMillis)
      The underlying HTTP client's write timeout (in milliseconds). The default is 10 seconds. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/write-timeout-millis/
    • setHttpClientCallTimeoutMillis

      public void setHttpClientCallTimeoutMillis(Integer httpClientCallTimeoutMillis)
      The underlying HTTP client's call timeout (in milliseconds). By default, there is no timeout for complete calls while there is for connect/write/read actions within a call. https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/call-timeout-millis/
    • setProxyUrl

      public void setProxyUrl(String proxyUrl)
      The proxy server URL supposed to be used for all api calls.
    • setProxyHeaders

      public void setProxyHeaders(Map<String,String> proxyHeaders)
      Additional headers for proxy (e.g., Proxy-Authorization)
    • setPrettyResponseLoggingEnabled

      public void setPrettyResponseLoggingEnabled(boolean prettyResponseLoggingEnabled)
    • setFailOnUnknownProperties

      public void setFailOnUnknownProperties(boolean failOnUnknownProperties)
      If you would like to detect unknown properties by throwing exceptions, set this flag as true.
    • setTokenExistenceVerificationEnabled

      public void setTokenExistenceVerificationEnabled(boolean tokenExistenceVerificationEnabled)
      Slack Web API client verifies the existence of tokens before sending HTTP requests to Slack servers.
    • setHttpClientResponseHandlers

      public void setHttpClientResponseHandlers(List<HttpResponseListener> httpClientResponseHandlers)
    • setAuditEndpointUrlPrefix

      public void setAuditEndpointUrlPrefix(String auditEndpointUrlPrefix)
    • setMethodsEndpointUrlPrefix

      public void setMethodsEndpointUrlPrefix(String methodsEndpointUrlPrefix)
    • setScimEndpointUrlPrefix

      public void setScimEndpointUrlPrefix(String scimEndpointUrlPrefix)
    • setScim2EndpointUrlPrefix

      public void setScim2EndpointUrlPrefix(String scim2EndpointUrlPrefix)
    • setStatusEndpointUrlPrefix

      public void setStatusEndpointUrlPrefix(String statusEndpointUrlPrefix)
    • setLegacyStatusEndpointUrlPrefix

      public void setLegacyStatusEndpointUrlPrefix(String legacyStatusEndpointUrlPrefix)
    • setExecutorServiceProvider

      public void setExecutorServiceProvider(ExecutorServiceProvider executorServiceProvider)
    • setMethodsConfig

      public void setMethodsConfig(MethodsConfig methodsConfig)
    • setAuditConfig

      public void setAuditConfig(AuditConfig auditConfig)
    • setSCIMConfig

      public void setSCIMConfig(SCIMConfig sCIMConfig)
    • setSCIM2Config

      public void setSCIM2Config(SCIM2Config sCIM2Config)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object