Search in sources :

Example 1 with CompositeJobListener

use of org.apache.gobblin.runtime.listeners.CompositeJobListener in project incubator-gobblin by apache.

the class AzkabanJobLauncher method initJobListener.

protected JobListener initJobListener() {
    CompositeJobListener compositeJobListener = new CompositeJobListener();
    List<String> listeners = new State(props).getPropAsList(GOBBLIN_CUSTOM_JOB_LISTENERS, EmailNotificationJobListener.class.getSimpleName());
    try {
        for (String listenerAlias : listeners) {
            ClassAliasResolver<JobListener> conditionClassAliasResolver = new ClassAliasResolver<>(JobListener.class);
            compositeJobListener.addJobListener(conditionClassAliasResolver.resolveClass(listenerAlias).newInstance());
        }
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
        throw new IllegalArgumentException(e);
    }
    return compositeJobListener;
}
Also used : EmailNotificationJobListener(org.apache.gobblin.runtime.listeners.EmailNotificationJobListener) JobListener(org.apache.gobblin.runtime.listeners.JobListener) CompositeJobListener(org.apache.gobblin.runtime.listeners.CompositeJobListener) EmailNotificationJobListener(org.apache.gobblin.runtime.listeners.EmailNotificationJobListener) CompositeJobListener(org.apache.gobblin.runtime.listeners.CompositeJobListener) State(org.apache.gobblin.configuration.State) ClassAliasResolver(org.apache.gobblin.util.ClassAliasResolver)

Aggregations

State (org.apache.gobblin.configuration.State)1 CompositeJobListener (org.apache.gobblin.runtime.listeners.CompositeJobListener)1 EmailNotificationJobListener (org.apache.gobblin.runtime.listeners.EmailNotificationJobListener)1 JobListener (org.apache.gobblin.runtime.listeners.JobListener)1 ClassAliasResolver (org.apache.gobblin.util.ClassAliasResolver)1