其他分享
首页 > 其他分享> > rabbitMQ 携带消息体之外的消息 使用 MessageProperties

rabbitMQ 携带消息体之外的消息 使用 MessageProperties

作者:互联网

发送消息

@RequestMapping("serviceMessage")
    public R serviceMessage(){
        String msgStr = "[{\"id\": 4024,\"channelPrimaryId\": 5,\"recordDate\": 1638288000000,\"integrityStatus\": 0,\"ignore\": 0,\"updateDate\": 1646079000000,\"checkFailDescri\": \"未获取到记录;\",\"dvsCode\": \"9\",\"chnnCode\": \"1\",\"recordType\": 0,\"loseTime\": 0,\"status\": false,\"reason\": null,\"loseSpan\": null,\"checkSpan\": \"[{\\\"ST\\\":\\\"08:30:00\\\",\\\"ET\\\":\\\"17:00:00\\\"}]\"},{\"id\": 4025,\"channelPrimaryId\": 6,\"recordDate\": 1638288000000,\"integrityStatus\": 0,\"ignore\": 0,\"updateDate\": 1646079000000,\"checkFailDescri\": \"未获取到记录;\",\"dvsCode\": \"9\",\"chnnCode\": \"2\",\"recordType\": 0,\"loseTime\": 0,\"status\": false,\"reason\": null,\"loseSpan\": null,\"checkSpan\": \"[{\\\"ST\\\":\\\"09:00:00\\\",\\\"ET\\\":\\\"17:00:00\\\"}]\"},{\"id\": 4026,\"channelPrimaryId\": 6,\"recordDate\": 1638374400000,\"integrityStatus\": 0,\"ignore\": 0,\"updateDate\": 1646079000000,\"checkFailDescri\": \"未获取到记录;\",\"dvsCode\": \"9\",\"chnnCode\": \"2\",\"recordType\": 0,\"loseTime\": 0,\"status\": false,\"reason\": null,\"loseSpan\": null,\"checkSpan\": \"[{\\\"ST\\\":\\\"09:00:00\\\",\\\"ET\\\":\\\"17:00:00\\\"}]\"}]";

        MessageProperties messageProperties = new MessageProperties();
        messageProperties.setHeader("sendId","111");
        Message message = new Message(msgStr.getBytes(), messageProperties);
        rabbitTemplate.send("extendsDirectQueue", message);
//        rabbitTemplate.convertAndSend("centerDeliverExchange", "extendsDirectQueue", JSONObject.toJSONString(logEntity));
        return R.ok();
    }

 

接收消息

 

标签:00,checkFailDescri,1646079000000,recordType,MessageProperties,rabbitMQ,消息,null,d
来源: https://www.cnblogs.com/guanxiaohe/p/15953459.html