Error: Invalid spaceKey on retrieving a related space config.

Notifications about changes to centralized configuration settings

When the AR System server detects any changes to the centralized configuration settings, it sends a notification, after a 5 second delay, to the components regarding the change. Each affected component then updates the setting across all instances.

For example, when you change the value of the arsystem.session_timeout setting, the AR System server notifies BMC Remedy Mid Tier regarding the change. The mid tier, in turn, updates the setting across all mid tiers in that cluster within 30 seconds.

Notifying the configuration change

When any configuration changes, the integrating application should get a notification. You need to write a code to get these notifications. Refer to the following code:

import java.util.List;

import com.bmc.arsys.api.ARException;
import com.bmc.arsys.api.ARServerUser;
import com.bmc.arsys.companion.client.configuration.ConfigurationChange;
import com.bmc.arsys.companion.client.configuration.ConfigurationClient;
import com.bmc.arsys.companion.client.configuration.ConfigurationClientFactory;
import com.bmc.arsys.companion.client.configuration.ConfigurationListener;
import com.bmc.arsys.companion.client.notification.NotificationClient;
import com.bmc.arsys.companion.client.notification.NotificationClientFactory;
import com.bmc.arsys.util.ArrayCentralConfig;
import com.bmc.arsys.util.CentralConfigFactory;

public class NotificationRegistrationTest implements ConfigurationListener {

    protected static ARServerUser serverUser = null;
    protected static ArrayCentralConfig centralConfig = null;
    // provide appropriate user name for the server
    protected static String user = "Demo";
    // provide appropriate password for the user name
    protected static String password = "";
    protected static String authentication = "";
    protected static String locale = null;
    // provide arserver name
    protected static String serverName = "localhost";
    protected static int tcpPort = 0;
    protected static int NOTIFICATION_INTERVAL = 30;
    // hostname
    protected static String hostname = "localhost";
    protected static int RMIPORT = 0;
    protected static String componenttype = "com.bmc.arsys.pluginServer";
    protected static String componentName = "PluginServer_IN-santokum-w1_9977_IDGBJ2JDGUNAAAPIKATOPHN12DAI6RPluginServer_clm-pun-022381_9977_IDGBJ2JDGUNAAAPIKATOPHN12DAI6R";

    public static void main(String[] args) {

        serverUser = new ARServerUser(user, password, authentication, locale,
                serverName, tcpPort);
        // write a class implementing ConfigurationListener. This class will have update function
        // which will receive notification for changes in configuration for component type and
        // component name registered.
        NotificationRegistrationTest notificationListner = new NotificationRegistrationTest();
        ConfigurationClient client = new ConfigurationClientFactory().create(hostname, RMIPORT,
                serverUser, notificationListner, NOTIFICATION_INTERVAL);
        // add component type and component name for which you want change notification to be
        // recieved.
        client.addConfiguration(componenttype, componentName);
        // Initialize the notification client
        NotificationClient notificationClient = new NotificationClientFactory().create(hostname,
                serverUser, NOTIFICATION_INTERVAL);
        notificationClient.addListener(client);
        client.start();
        notificationClient.start();

    }

    @Override
    public void update(ConfigurationChange confChange) {
        // get new configuration
        // compare with existing configuration and take appropriate action where changes occured.
        CentralConfigFactory factory = CentralConfigFactory.newInstance(serverUser);
        ArrayCentralConfig centralConfig = factory.newArrayCentralConfig();
        List<String[]> settings = null;
        try {
            settings = centralConfig.getConfigSettingsAsList(componentName, componenttype, null);
        } catch (ARException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}




Was this page helpful? Yes No Submitting... Thank you

Comments