Initialization
To create a Wingify Client instance, you need to initialize the Wingify FE Java SDK. This client instance serves as the core interface for conducting Feature Experimentation(A/B and personalization) within your application.
#Usage
import com.wingify.Wingify;
import com.wingify.models.user.WingifyInitOptions;
// Initialize Wingify SDK
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
// Set SDK Key and Account ID
wingifyInitOptions.setSdkKey("sdk-key"); //SDK Key
wingifyInitOptions.setAccountId(123); //account ID
// create Wingify instance with the wingifyInitOptions
Wingify wingifyClient = Wingify.init(wingifyInitOptions);
An object of wingifyInitOptions is created to store the SDK configuration details.
The init() function is called with the wingifyInitOptions object. It initializes and returns a Wingify Client Object wingifyClient, which can be used to perform feature
This client object allows you to run experiments, track events, and enable/disable feature flags.
#Parameter Definitions
| Parameter |
|---|
| **accountId** _Required_ |
#Poll Interval (Keeping Wingify client up-to-date)
When you initialize the wingifyClient on your server, it pulls the latest configurations you've done in the Wingify application.
If/when you make any changes to the feature flags or rules within Wingify after the wingifyClient has been initialized in your server, there needs to be some way to update your wingifyClient with the latest settings from. This can be done via polling.
The poll interval is an optional parameter that allows the SDK to automatically fetch and update settings from the Wingify server at specified intervals. Setting this parameter ensures your application always uses the latest configuration.
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setPollInterval(60000); // Set the poll interval to 60 seconds
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
#Logger
Wingify by default logs all ERROR level messages to your server console. To gain more control over Wingify's logging behavior, you can use the logger parameter in the init configuration.
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setAccountId(123456);
wingifyInitOptions.setSdkKey("32-alpha-numeric-sdk-key");
Map<String, Object> logger = new HashMap<>();
logger.put("level", "DEBUG");
wingifyInitOptions.setLogger(logger);
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
Please click here for more advanced logger options.
#Storage
By default, the SDK operates in stateless mode, evaluating flags on each getFlag call. To improve performance and consistency, you can use a custom storage mechanism to cache decisions, ensuring stable user experiences and reducing application load.
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setAccountId(123456);
wingifyInitOptions.setSdkKey("32-alpha-numeric-sdk-key");
wingifyInitOptions.setStorage(storageObject)
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
Please click storage to learn more about storage implementation.
#Gateway Service
The Wingify FE Gateway Service enhances Feature Experimentation (FE) SDKs by enabling pre-segmentation based on user location and user agent. It ensures minimal latency and improved security. The service can be customized via the gateway_service parameter during initialization.
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setAccountId(123456);
wingifyInitOptions.setSdkKey("32-alpha-numeric-sdk-key");
Map < String , Object > gatewayService = new HashMap <> ();
gatewayService.put("url", "http://custom.gateway.com");
wingifyInitOptions.setGatewayService(gatewayService);
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
Please click GatewayService to learn more about gateway service.
#Integrations
Wingify FE SDKs provide seamless integration with third-party tools like analytics platforms, monitoring services, customer data platforms (CDPs), and messaging systems. This is achieved through a simple yet powerful callback mechanism that receives Wingify-specific properties and can forward them to any third-party tool of your choice.
IntegrationCallback integrations = new IntegrationCallback() {
@Override
public void execute(Map < String , Object > properties) {
// your function definition
}
};
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setSdkKey("32-alpha-numeric-sdk-key");
wingifyInitOptions.setAccountId(12345);
wingifyInitOptions.setIntegrations(integrations);
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
Please click here to learn more about Integrations,.
#ProxyUrl
Wingify FE SDKs provide support for redirecting all network calls through a custom proxy URL. This feature enables users to route all SDK network requests (including settings, tracking, etc.) through their own proxy server.
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setSdkKey("32-alpha-numeric-sdk-key");
wingifyInitOptions.setAccountId(12345);
wingifyInitOptions.setProxyUrl("http://custom.proxy.com");
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
Please click
#Retry Configuration
The SDK includes a built-in retry mechanism to improve reliability when network requests fail due to transient issues such as timeouts or temporary connectivity problems. You can fully control this behavior by providing a retryConfig object during SDK initialization.
WingifyInitOptions wingifyInitOptions = new WingifyInitOptions();
wingifyInitOptions.setSdkKey("32-alpha-numeric-sdk-key");
wingifyInitOptions.setAccountId(12345);
// Configure Network Retry
RetryConfig retryConfig = new RetryConfig();
retryConfig.setShouldRetry(true); // Enable/Disable retries
retryConfig.setMaxRetries(3); // Max number of retries
retryConfig.setInitialDelay(2); // Initial delay in seconds (default is 2)
retryConfig.setBackoffMultiplier(2); // Backoff multiplier (default is 2)
wingifyInitOptions.setRetryConfig(retryConfig);
Wingify wingifyInstance = Wingify.init(wingifyInitOptions);
Please click