- Enclosing class:
- Configuration
Provides a fluent API for configuring all aspects of the Centrifugo client. Default values are provided for most settings to ensure the client works out-of-the-box with minimal configuration.
-
Method Summary
Modifier and TypeMethodDescriptionadditionalRequestInterceptor(feign.RequestInterceptor additionalRequestInterceptor) Sets an additional request interceptor.Sets the API key for authenticating with Centrifugo.Sets the base URL for the Centrifugo server API.build()Builds the configuration instance with the specified settings.client(feign.Client client) Sets the HTTP client implementation to use.errorDecoder(feign.codec.ErrorDecoder errorDecoder) Sets the error decoder for handling HTTP error responses.feignOptions(feign.Request.Options feignOptions) Sets the HTTP request options including timeouts.logger(feign.Logger logger) Sets the logger implementation for HTTP request/response logging.logLevel(feign.Logger.Level logLevel) Sets the logging level for HTTP requests and responses.retryer(feign.Retryer retryer) Sets the retry policy for failed requests.
-
Method Details
-
apiKey
Sets the API key for authenticating with Centrifugo.The API key is sent in the
X-API-Keyheader with each request. This key must match thehttp_api.keyconfiguration in your Centrifugo server configuration.- Parameters:
apiKey- the API key for authentication- Returns:
- this builder instance
- See Also:
-
baseUrl
Sets the base URL for the Centrifugo server API.Should include the protocol, host, port, and path to the API endpoint. Typically this will be something like
http://localhost:8000/apiorhttps://centrifugo.example.com/api.- Parameters:
baseUrl- the base URL for API calls- Returns:
- this builder instance
-
client
Sets the HTTP client implementation to use.Allows customization of the underlying HTTP client. If not set, a default HTTP/2 client will be used.
- Parameters:
client- the HTTP client implementation- Returns:
- this builder instance
-
retryer
Sets the retry policy for failed requests.Configures how the client should handle request failures and retries. If not set, a default retry policy will be used.
- Parameters:
retryer- the retry policy implementation- Returns:
- this builder instance
-
feignOptions
Sets the HTTP request options including timeouts.Configures connection and read timeouts for HTTP requests. Default timeouts are usually sufficient for most use cases.
- Parameters:
feignOptions- the HTTP request options- Returns:
- this builder instance
-
logger
Sets the logger implementation for HTTP request/response logging.Useful for debugging API interactions. If not set, SLF4J logger will be used by default.
- Parameters:
logger- the logger implementation- Returns:
- this builder instance
-
errorDecoder
Sets the error decoder for handling HTTP error responses.Customizes how HTTP error responses are converted to Java exceptions. If not set, a default error decoder will be used.
- Parameters:
errorDecoder- the error decoder implementation- Returns:
- this builder instance
-
additionalRequestInterceptor
public Configuration.Builder additionalRequestInterceptor(feign.RequestInterceptor additionalRequestInterceptor) Sets an additional request interceptor.Allows adding custom headers or modifying requests before they are sent to the server. This is applied in addition to the built-in API key interceptor.
- Parameters:
additionalRequestInterceptor- the request interceptor- Returns:
- this builder instance
-
logLevel
Sets the logging level for HTTP requests and responses.Controls how much detail is logged about HTTP interactions. Options include NONE, BASIC, HEADERS, and FULL.
- Parameters:
logLevel- the logging level- Returns:
- this builder instance
-
build
Builds the configuration instance with the specified settings.Applies default values for any settings that were not explicitly configured.
- Returns:
- a new Configuration instance
-