package com.jay.monitor.data.server.store.es;

import com.jay.monitor.data.core.enums.MsgTypeEnums;
import com.jay.monitor.data.core.model.serializable.MQDataDTO;
import com.jay.monitor.data.server.componts.ElasticSearchPartition;
import com.jay.monitor.data.server.models.entity.es.JayMonitorMQIndex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author liukx
 */
public class ElasticMQStoreProcess extends AbstractElasticSearchStoreProcess<MQDataDTO, JayMonitorMQIndex> {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private ElasticSearchPartition<JayMonitorMQIndex, String> elasticSearchPartition;

    @Override
    public MsgTypeEnums msgTypeEnums() {
        return MsgTypeEnums.MQ;
    }

    @Override
    protected JayMonitorMQIndex builderJayMonitor(MQDataDTO request) {
        JayMonitorMQIndex index = new JayMonitorMQIndex();
        BeanUtils.copyProperties(request, index);
        return index;
    }

    @Override
    public String tableName() {
        return "jay_monitor_mq";
    }

}
