Search in sources :

Example 1 with CategorySubscriber

use of alma.acs.lasercore.test.stress.category.CategorySubscriber in project ACS by ACS-Community.

the class CategoryClient method connect.

/**
	 * Create the consumers for the passed categories
	 * 
	 *   
	 * @param categoriesToConnect The categories to connect to
	 */
public void connect(Category[] categoriesToConnect) throws Exception {
    if (categoriesToConnect == null || categoriesToConnect.length == 0) {
        contSvc.getLogger().log(AcsLogLevel.INFO, "No categories to connect to");
        return;
    }
    consumers = new CategorySubscriber[categoriesToConnect.length];
    int t = 0;
    Vector<String> failingConnections = new Vector<String>();
    for (Category category : categoriesToConnect) {
        try {
            consumers[t++] = new CategorySubscriber(contSvc, categoryRootTopic, category.path, this);
            contSvc.getLogger().log(AcsLogLevel.DEBUG, "Connected to " + categoryRootTopic + "." + category.path);
        } catch (Throwable throwable) {
            failingConnections.add("Error subscribing to " + categoryRootTopic + "." + category.path + ": " + throwable.getMessage());
        }
    }
    if (failingConnections.size() > 0) {
        System.err.println("Error connecting categories: ");
        for (String str : failingConnections) {
            System.err.println("\t" + str);
        }
        throw new Exception("Error connecting categories");
    }
}
Also used : Category(alma.alarmsystem.Category) CategorySubscriber(alma.acs.lasercore.test.stress.category.CategorySubscriber) Vector(java.util.Vector)

Aggregations

CategorySubscriber (alma.acs.lasercore.test.stress.category.CategorySubscriber)1 Category (alma.alarmsystem.Category)1 Vector (java.util.Vector)1