All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lmaye.cloud.starter.canal.handler.impl.AsyncMessageHandlerImpl Maven / Gradle / Ivy

package com.lmaye.cloud.starter.canal.handler.impl;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.alibaba.otter.canal.protocol.Message;
import com.lmaye.cloud.starter.canal.handler.AbstractMessageHandler;
import com.lmaye.cloud.starter.canal.handler.EntryHandler;
import com.lmaye.cloud.starter.canal.handler.RowDataHandler;

import java.util.List;
import java.util.concurrent.ExecutorService;

/**
 * -- AsyncMessageHandlerImpl
 *
 * @author Lmay Zhou
 * @date 2021/3/22 11:27
 * @email [email protected]
 */
public class AsyncMessageHandlerImpl extends AbstractMessageHandler {
    private final ExecutorService executor;

    public AsyncMessageHandlerImpl(List entryHandlers,
                                   RowDataHandler rowDataHandler, ExecutorService executor) {
        super(entryHandlers, rowDataHandler);
        this.executor = executor;
    }

    @Override
    public void handleMessage(Message message) {
        executor.execute(() -> super.handleMessage(message));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy