package com.lanyuanxiaoyao.service.launcher.configuration;

import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 集群相关配置
 *
 * @author ZhangJiacheng
 * @date 2023-05-09
 */
@ConfigurationProperties("connector.cluster")
@Component
public class ClusterConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(ClusterConfiguration.class);

    private String cluster;
    private String syncQueueName;
    private String compactionQueueName;

    @PostConstruct
    private void init() {
        logger.info("Configuration initial: {}", this);
    }

    public String getCluster() {
        return cluster;
    }

    public void setCluster(String cluster) {
        this.cluster = cluster;
    }

    public String getSyncQueueName() {
        return syncQueueName;
    }

    public void setSyncQueueName(String syncQueueName) {
        this.syncQueueName = syncQueueName;
    }

    public String getCompactionQueueName() {
        return compactionQueueName;
    }

    public void setCompactionQueueName(String compactionQueueName) {
        this.compactionQueueName = compactionQueueName;
    }

    @Override
    public String toString() {
        return "ClusterConfiguration{" +
               "cluster='" + cluster + '\'' +
               ", syncQueueName='" + syncQueueName + '\'' +
               ", compactionQueueName='" + compactionQueueName + '\'' +
               '}';
    }
}
