Setup

Installation

Our SDK is free to use and it's available as a package on Maven Central repository. You can add it to your project easily through either Maven or Gradle.

Maven

<dependencies>
...
        <dependency>
            <groupId>com.attraqt</groupId>
            <artifactId>sdk-fhr-ab-testing</artifactId>
            <version>1.0.0</version>
        </dependency>
...
</dependencies>

Gradle

dependencies {
    implementation 'sdk-fhr-ab-testing:1.0.0'
}

Important! Make sure you include the latest version for the most up to date features and functionality.

Initialization

Standard

In order to be able to initialize your SDK you will need the following:

  • url - the base URL for getting the running A/B tests provided by the technical consultant (without the path /config/running/ab-tests).

  • username and password - the Basic Authentication credentials you normally use for all your FHR queries.

To initialize the SDK in your Java code you can look at the following snippet.

 import com.attraqt.sdk.fhr.abtesting.AbTesting

...

AbTesting abTesting = AbTesting.builder()
                               .abTestsServerUrl("url")
                               .username("username")
                               .password("password")       
                               .build();

abTesting.start();

This is the most basic initialization you can do. The call to start() at the end, starts the retrieval of running A/B tests on a periodic basis of 5 minutes by default, storing the response in the mean time.

This should be enough for most use cases. However, the SDK offers a bit more customization.

Custom

Apart from the mandatory url, username and password, you can also supply the following details:

  • cacheExpireTimeMinutes - Integer - the SDK caches the running A/B tests, and you can control the time between refreshes. The minimum and also default expire time of the cache is 5 minutes. If you provide a number lower than 5, the time will be set to 5.

  • abTestsCache - AbTestsCache object - Provide a custom implementation of the AbTestCache object to override the provided in-memory caching behavior.

    Only set if custom caching logic is required. Default implementation should be used as standard.

  • runningAbTestsFetcher - RunningAbTests object - Provide a custom implementation of the RunningAbTests object to override the provided ab-tests fetching behaviour.

    Only set if custom ab-tests fetching logic is required. Default implementation should be used as standard.

For the abTestsCache and the runningAbTestsFetcher, you can check out the extension section.

pageExtending the SDK

Use

Once initialized you can check out the corresponding pages on each of the key functionalities available in the SDK. **These pages essentially cover a built-in implementation of what's covered in the Overview. You can start with the first step - Retrieve running A/B tests.**

pageRetrieve running A/B tests - Java SDK

Last updated