Java Code Examples for com.alibaba.otter.canal.sink.entry.EntryEventSink#getHandlers()

The following examples show how to use com.alibaba.otter.canal.sink.entry.EntryEventSink#getHandlers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntryCollector.java    From canal-1.1.3 with Apache License 2.0 6 votes vote down vote up
private void unloadHandler(EntryEventSink entrySink) {
    List<CanalEventDownStreamHandler> handlers = entrySink.getHandlers();
    int i = 0;
    for (; i < handlers.size(); i++) {
        if (handlers.get(i) instanceof PrometheusCanalEventDownStreamHandler) {
            break;
        }
    }
    entrySink.removeHandler(i);
    // Ensure no PrometheusCanalEventDownStreamHandler
    handlers = entrySink.getHandlers();
    for (CanalEventDownStreamHandler handler : handlers) {
        if (handler instanceof PrometheusCanalEventDownStreamHandler) {
            throw new IllegalStateException("Multiple prometheusCanalEventDownStreamHandler exists in handlers.");
        }
    }
}
 
Example 2
Source File: EntryCollector.java    From canal with Apache License 2.0 6 votes vote down vote up
private void unloadHandler(EntryEventSink entrySink) {
    List<CanalEventDownStreamHandler> handlers = entrySink.getHandlers();
    int i = 0;
    for (; i < handlers.size(); i++) {
        if (handlers.get(i) instanceof PrometheusCanalEventDownStreamHandler) {
            break;
        }
    }
    entrySink.removeHandler(i);
    // Ensure no PrometheusCanalEventDownStreamHandler
    handlers = entrySink.getHandlers();
    for (CanalEventDownStreamHandler handler : handlers) {
        if (handler instanceof PrometheusCanalEventDownStreamHandler) {
            throw new IllegalStateException("Multiple prometheusCanalEventDownStreamHandler exists in handlers.");
        }
    }
}
 
Example 3
Source File: EntryCollector.java    From canal-1.1.3 with Apache License 2.0 5 votes vote down vote up
private PrometheusCanalEventDownStreamHandler assembleHandler(EntryEventSink entrySink) {
    PrometheusCanalEventDownStreamHandler ph = new PrometheusCanalEventDownStreamHandler();
    List<CanalEventDownStreamHandler> handlers = entrySink.getHandlers();
    for (CanalEventDownStreamHandler handler : handlers) {
        if (handler instanceof PrometheusCanalEventDownStreamHandler) {
            throw new IllegalStateException("PrometheusCanalEventDownStreamHandler already exists in handlers.");
        }
    }
    entrySink.addHandler(ph, 0);
    return ph;
}
 
Example 4
Source File: EntryCollector.java    From canal with Apache License 2.0 5 votes vote down vote up
private PrometheusCanalEventDownStreamHandler assembleHandler(EntryEventSink entrySink) {
    PrometheusCanalEventDownStreamHandler ph = new PrometheusCanalEventDownStreamHandler();
    List<CanalEventDownStreamHandler> handlers = entrySink.getHandlers();
    for (CanalEventDownStreamHandler handler : handlers) {
        if (handler instanceof PrometheusCanalEventDownStreamHandler) {
            throw new IllegalStateException("PrometheusCanalEventDownStreamHandler already exists in handlers.");
        }
    }
    entrySink.addHandler(ph, 0);
    return ph;
}