Repository Integration

In the Management Console you also specify cluster of RoboServers, these are used to execute scheduled robots, as well as robots executed as REST services. The API allowed you to use the RepositoryClient to obtain cluster information from Management Console, check the RepositoryClient documentation for details.


public class RepositoryIntegration {
    public static void main(String[] args) throws Exception {

        RepositoryClient client = RepositoryClientFactory.createRepositoryClient("http://localhost:50080", null, null);
        Request.registerCluster(client, "Cluster 1");

        Request request = new Request("Library:/Tutorials/NewsMagazine.robot");
        request.setRobotLibrary(new DefaultRobotLibrary());
        RQLResult result = request.execute("MyCluster");
        System.out.println(result);
    }
}
                          

Repository Integration


The above example shows how to create a RepositoryClient which connects to a Management Console deployed on localhost. For this example to work, you must have commons-logging-1.1.1.jar,commons-codec-1.4.jar,commons-httpclient-4.1.jar included in your classpath.

Authentication is not enabled so null is passed as both username and password. When we register the RepositoryClient we specify the name of a cluster which exists on the Management Console, this will then query the Management Console to get a list of RoboServers configured for this cluster, and check every 2 minutes to see if the cluster configuration has been updated on the Management Console.

This integration allows you to create a cluster on Management Console that you can change dynamically using the Management Console user interface. When you use a Management Console cluster with the API usage should be exclusive, and you should not use it for scheduling robot, as this would break the two client rule.