【问题标题】:ActiveMQ - STOMP subscribe with selector failsActiveMQ - STOMP 订阅选择器失败
【发布时间】: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


【解决方案1】:

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

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

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

希望对你有帮助……

【讨论】:

  • 这并没有给我们正确的答案。我正在尝试做同样的事情,var headers = {'selector': "hello = 'world'"};,虽然我无法让它工作
猜你喜欢
  • 2013-06-27
  • 2017-09-13
  • 2013-01-16
  • 2016-11-09
  • 2018-10-31
  • 2011-10-20
  • 2015-07-08
  • 2014-08-21
  • 2016-06-08
相关资源
最近更新 更多