0

客户端设置以在 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'"};

我错过了什么?

4

1 回答 1

-1

我可以发布我在标题中发送选择器的方式..看:

Headers:{
    "activemq.advisory" = true;
    "activemq.prefetchSize" = 1;
    selector = "switch = 'green'";
}

我正在使用 STOMP 和 Objective-C ......

我希望这会有所帮助...

于 2014-07-29T13:35:31.790 回答