Create Alternate Application Contexts

The SDK presumes a default application context that has no name associated with it.

To create the default application context, use the appd_config_init() command which returns a pointer to the default configuration structure. Then, use setter commands to modify the fields within the structure. Once all relevant fields are set, use the appd_sdk_init() call to initialize the SDK with the default application context.

All other application contexts are created with an associated name and a collection of separate setter methods.

To create an alternate application context, pass the appd_context_config_init() command the name of your alternate application context. This will return a pointer to the alternate application context configuration structure. Then, use the _context_ setter commands to modify the fields within the structure. Once all relevant fields are set, use the appd_sdk_add_app_context() call to initialize the SDK, passing it the alternate application context structure pointer.

// create the alternate application context
appd_context_config* cfg2 = appd_context_config_init("My_Context");
...
// add additional setter commands to initialize the alternate application context
appd_context_config_set_controller_account(cfg2, ac.second.ac_account_get().c_str());
appd_context_config_set_controller_access_key(cfg2, ac.second.ac_access_key_get().c_str());
appd_context_config_set_controller_host(cfg2, ac.second.ac_host_get().c_str());
appd_context_config_set_controller_port(cfg, ac.second.ac_port_get());
appd_context_config_set_controller_use_ssl(cfg2, ac.second.ac_use_ssl_get() ? 1 : 0);
appd_context_config_set_app_name(cfg2, ac.second.ac_app_get().c_str());
appd_context_config_set_tier_name(cfg2, ac.second.ac_tier_get().c_str());
appd_context_config_set_node_name(cfg2, ac.second.ac_node_get().c_str());
// initialize the alternate application context
appd_sdk_add_app_context(cfg2);