package org.springblade.flow.engine.custom.event.logger;

import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.impl.runtime.Clock;
import org.flowable.engine.impl.event.logger.EventFlusher;
import org.flowable.engine.impl.event.logger.EventLogger;
import org.springblade.flow.engine.custom.event.flusher.ElasticSearchFlusher;
import org.springblade.flow.engine.custom.event.handler.EntityUpdatedEventHandler;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author LoveMyOrange
 * @create 2022-02-02 11:45
 */
public class ElasticSearchEventLogger extends EventLogger {
    @Override
    protected EventFlusher createEventFlusher() {
        ElasticSearchFlusher elasticSearchFlusher = new ElasticSearchFlusher();
        return elasticSearchFlusher;
    }

    public ElasticSearchEventLogger(Clock clock, ObjectMapper objectMapper) {
        super(clock, objectMapper);
    }

    @Override
    protected void initializeDefaultHandlers() {
        super.initializeDefaultHandlers();
        addEventHandler(FlowableEngineEventType.ENTITY_UPDATED, EntityUpdatedEventHandler.class);
    }
}







