派生自 projectDept/qhighschool

EricsHu
2023-11-26 1da190e7f267bcd3501884f3aeaac7476850fec7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.qxueyou.scc.sys.msg;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
 
@Component
public class CustomerMsgProducerService implements ICustomerMsgProducerService{
    
    @Autowired
    KafkaTemplate<String,String>  template;
    
    public static String VIDEO_LIVE_TOPIC ="test.topic";
 
    @Override
    public void doSendMediaVideoLiveMsg() {
        
        for(int i=0;;){
            i++;
            template.setDefaultTopic(VIDEO_LIVE_TOPIC);
            template.sendDefault(String.valueOf(i), "foo"+i);
            try {
                Thread.sleep(10*1000);
                 template.flush();
            } catch (InterruptedException e) {
                
            }
           
        }
        
//        template.flush();
//        container.stop();
        
    }
    
    
    
    
}