Retrieve running A/B tests - Java SDK

As mentioned in the previous section, once the AbTesting object has been initialized and start() has been called, the SDK commences with periodic requests to retrieve and cache the currently running A/B tests.

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

...

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

abTesting.start();

Important! The AbTesting object should be created and started once per application instance and shared between web requests.

Once the retrieval has started, you can call the isStarted() method to check whether the process is started, like so:

boolean isStarted = abTesting.isStarted();

Additionally, if you want to stop the retrieval, you can call the shutdown() method which will stop the retrieval and clean up any of the cached results.

abTesting.shutdown();

Important! The SDK works completely in memory so any stored queries and data will be available for as long as the application is running.

When you have your retrieval of running A/B tests fully functioning you can move on to the next section which covers the filtering of the A/B tests for a given page, and assigning variants to the user.

pageFilter and request variant - Java SDK

Last updated