package com.fdkankan.scene.listener;

import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@RocketMQMessageListener(
        consumerGroup = "test_group_dsx",
        topic = "test_topic_dsx",
        messageModel = MessageModel.CLUSTERING,
        consumeThreadMax = 1,
        consumeTimeout = 7200000L
)
@Data
public class TestListener implements RocketMQListener<String> {

    @Value("${rocketmq.build-scene-result.topicName.topic-modeling-a}")
    private String buildSceneResultTopic;


    @SneakyThrows
    @Override
    public void onMessage(String message) {

        System.out.println("开始消费:" + message + "线程id=" + Thread.currentThread().getName());

        buildSceneResultTopic = "123123123123";


        Thread.sleep(3600000L);



        System.out.println("结束消费:" + message);


    }

}
