package org.security.basicDataSync.controller;

//import com.ynhtbank.emb.base.ConsumerCallback;
//import com.ynhtbank.emb.base.message.HtbMessage;
//import com.ynhtbank.emb.pulsar.HtbPulsarConsumer;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.security.basicDataSync.service.IDeptLevlSyncHistoryService;
import org.security.config.ESMProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：wzf
 * @apiNote ：消息服务总线
 * @since ：Created in 2022/8/26 14:19
 */
@Component
@AllArgsConstructor
@Slf4j
public class HtbPulsarConsumerController {
	private final IDeptLevlSyncHistoryService deptLevlSyncHistoryService;
	private final ESMProperties esmProperties;
//	@Bean
//	public void syncMsgData() throws Exception{
//		HtbPulsarConsumer pulsarConsumer = new HtbPulsarConsumer();
//		pulsarConsumer.setBrokerServiceurl(esmProperties.getBrokerServiceurl());
//		pulsarConsumer.setAccessToken(esmProperties.getAccessToken());
//		pulsarConsumer.setSubscriptionName(esmProperties.getSubscriptionName());
//		pulsarConsumer.setListenerName(esmProperties.getListenerName());
//		pulsarConsumer.setEnvValue(esmProperties.getEvnValue());
//		pulsarConsumer.setTopicNames(esmProperties.getTopicNames());
//		pulsarConsumer.setCorePoolSize(esmProperties.getCorePoolSize());
// 		log.info("消息总线请求url【】" + esmProperties.getBrokerServiceurl());
//		log.info("消息发布主题【】" + esmProperties.getTopicNames().toString());
//		log.info("消息总线请求envValue【】" + esmProperties.getEvnValue());
//		log.info("消息监听者名称【】" + esmProperties.getListenerName());
//		log.info("接收到消息-----------------------------开始");
//		pulsarConsumer.setConsumerCallback(new ConsumerCallback() {
//			public void handle(HtbMessage message){
//				//消息消费处理
//				deptLevlSyncHistoryService.consumeMsg(message);
//			}
//		});
//		pulsarConsumer.init();
//	}
}
