admin
2024-10-30 010ef2a907e66efd4702443c06cdd18f8a7ffa5b
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
package com.yeshi.buwan.util.mq.rabbit.consumer;
 
import com.rabbitmq.client.Channel;
import com.yeshi.buwan.util.mq.rabbit.RabbitmqMsgConsumeUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.stereotype.Component;
import org.yeshi.utils.StringUtil;
 
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
 
/**
 * @author hxh
 * @title: QueueHelloWorldListener
 * @description:
 * @date 2024/9/26 13:47
 */
public class VideoSyncDataV2Listener   implements ChannelAwareMessageListener {
 
    @Resource
    private RabbitTemplate rabbitTemplate;
 
    @Override
    public void onMessage(Message message, Channel channel) throws Exception {
        RabbitmqMsgConsumeUtil.processMessage(message, channel, rabbitTemplate, () -> {
            String result = new String(message.getBody(), StandardCharsets.UTF_8);
            //TODO 处理消息
            if(!StringUtil.isNullOrEmpty(result)) {
            }
        });
    }
}