首页 > TAG信息列表 > MessageProperties
rabbitMQ 携带消息体之外的消息 使用 MessageProperties
发送消息 @RequestMapping("serviceMessage") public R serviceMessage(){ String msgStr = "[{\"id\": 4024,\"channelPrimaryId\": 5,\"recordDate\": 1638288000000,\"integrityStatus\": 0,\&qJava笔记-spring-rabbit框架中消息中header的添加
对应的application.properties如下: spring.rabbitmq.host=122.xx.xxx.xxx spring.rabbitmq.port=5672 spring.rabbitmq.username=xxxxxx spring.rabbitmq.password=xxxxxx spring.rabbitmq.virtual-host=/xxxxxx spring.rabbitmq.cache.channel.checkout-timeout=10 关键代码如springBoot + RabbitMq时候遇到的诡异问题
在使用MQ时候,使用的Exchange 是 TOPIC 类型的 监听该对列的时候发现返回的数据很奇葩,在这纪录一下 import org.springframework.amqp.core.Message; @RabbitListener(queues = XXX) @RabbitHandler public void receive(Message msg) { byte[] body = msg.getBody();rabbitmq RabbitTemplate
@Bean public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) { RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory); return rabbitTemplate; } @Test public void testSendMessage() throws Exception { //1 创建消息