All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.meta.SphereClientTuningDocumentation Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.meta;

import com.ning.http.client.AsyncHttpClient;

/**

 

Using design patterns to add functionality to the clients

The clients are interfaces which have a default implementation (add "Impl" to the interface name).
This enables you to use the decorator pattern to configure the cross concern behaviour of the client:

  • setup recover mechanisms like returning empty lists or retry the request
  • log events
  • set timeouts (depending on the future implementation)
  • return fake answers for tests
  • configure throttling.

The following listing shows a pimped client which updates metrics on responses, retries commands and sets default values:

{@include.example io.sphere.sdk.client.WrappedClientDemo}

Configure the underlying http client.

{@link io.sphere.sdk.http.HttpClient} is an abstraction to perform http requests.

{@link io.sphere.sdk.http.AsyncHttpClientAdapter#of(AsyncHttpClient)} wraps a ning {@link AsyncHttpClient} as {@link io.sphere.sdk.http.HttpClient}.

The following example creates a configured HTTP client and initializes a {@link io.sphere.sdk.client.SphereClient} with it.

{@include.example io.sphere.sdk.client.CustomClientConfigDemoTest}

For configuration parameters refer to github.com/AsyncHttpClient/async-http-client.

*/ public class SphereClientTuningDocumentation { private SphereClientTuningDocumentation() { } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy