2014-02-25 30 views
0

在STOMP订阅上实现选择器的客户端设置。ActiveMQ - 使用选择器订阅的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'"}; 

我在想什么?

+0

您正在使用哪个STOMP客户端库?你为什么在回调方法中订阅?请阅读订阅方法的文档,因为它看起来像你没有正确地给选择器。 – Buchi

回答

0

我可以张贴我的方式里面头送选择..看看:

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

我使用STOMP和Objective-C ...

我希望帮助...