【发布时间】:2014-03-28 11:48:45
【问题描述】:
客户端设置以在 STOMP 订阅上实现选择器。
var headers = {hello: 'worldtest'};
console.log(event.get('header').data.eventType);
var connectCallback = function(frame) {
stompClient.subscribe("/topic/receipt", function(frame){console.log(frame);}, headers);
stompClient.send("/app/" + url.join('/'), {"content-type": "text/plain"}, message);
};
订阅返回一条记录到框架控制台的消息,例如:
body: ""<message>test</message>""
command: "MESSAGE"
headers: Object
content-length: "343"
content-type: "application/json;charset=UTF-8"
destination: "/topic/receipt"
hello: "world"
message-id: "4hw8wlab-1"
subscription: "sub-0"
消息不应该因为选择器而被过滤掉吗?我的选择器的语法?
将语法更改为以下也不起作用。在这种情况下,根本没有返回任何消息。
var headers = {'selector': "hello = 'world'"};
我错过了什么?
【问题讨论】:
-
您使用的是哪个 STOMP 客户端库?为什么要订阅回调方法?请阅读 subscribe 方法的文档,因为您似乎没有正确提供选择器。
标签: header activemq stomp sockjs