package com.ycl.jxkg.rabbitmq.product;
|
|
import com.ycl.jxkg.rabbitmq.MyCorrelationData;
|
import com.ycl.jxkg.rabbitmq.RabbitMqMsgTypeEnum;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.core.MessageProperties;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.stereotype.Component;
|
|
import java.nio.charset.StandardCharsets;
|
|
/**
|
* @author:xp
|
* @date:2024/6/28 11:18
|
*/
|
@Component
|
@RequiredArgsConstructor
|
public class Product {
|
|
private final RabbitTemplate rabbitTemplate;
|
|
public void examMsg() {
|
// 设置消息的关联数据,以便发送确认回调、未路由成功消息的处理
|
MyCorrelationData msgCorrelationData = new MyCorrelationData("ddddd", RabbitMqMsgTypeEnum.EXAM);
|
rabbitTemplate.convertAndSend("examDlxQueue", (Object) "你好,RabbitMQ", msgCorrelationData);
|
}
|
|
public void meetMsg() {
|
rabbitTemplate.convertAndSend("meetDlxQueue","你好,RabbitMQ");
|
}
|
|
}
|