我已经为 rabbit mq 设置了一个简单的监听器
@RabbitListener(queues = SECOND_QUEUE)
public void onMessage(Message message) {
LOGGER.info("second queue listener.........");
LOGGER.info(message.toString());
}
这给出了这种格式的消息
(Body:'1460' MessageProperties [headers={}, timestamp=null, messageId=null, userId=null, receivedUserId=null, appId=null, clusterId=null, type=null, correlationId=null, correlationIdString=null, replyTo=null, contentType=application/x-java-serialized-object, contentEncoding=null, contentLength=0, deliveryMode=null, receivedDeliveryMode=PERSISTENT, expiration=null, priority=0, redelivered=false, receivedExchange=, receivedRoutingKey=bottomlesspit, receivedDelay=null, deliveryTag=1, messageCount=0, consumerTag=amq.ctag-PpEjG_BokAg-A4wllCgeqA, consumerQueue=bottomlesspit])
在控制台上。
我也有兴趣在客户端处理消息,我有这个
var onConnect = function() {
client.subscribe("/topic/messages", function(d) {
var str = d.body
var res = str.match(/Body:\'(.+)\'/);
console.log("I control this",res[1]);
});
};
我只想在 java 中获取主体,因为它是我目前唯一感兴趣的部分。
是否有一个功能已经在 java 和 stomp 中实现,仅用于获取正文部分?。
翻翻过去那场雪
明月笑刀无情
千巷猫影
BIG阳
随时随地看视频慕课网APP
相关分类