STOMP with Go

agolangf · · 1235 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Does anyone have an example of using selectors in GO? According to the STOMP documentation, they are passed in at subscription time, but I&#39;ve yet to find an example of this.</p> <hr/>**评论:**<br/><br/>metakeule: <pre><p>Not being familiar with STOMP, may I ask what you mean exactly with &#34;selectors&#34;?</p></pre>salopru: <pre><p>Selectors are, in a nutshell, message filters. See the table &#34;ActiveMQ Extensions to STOMP&#34; at <a href="http://activemq.apache.org/stomp.html" rel="nofollow">http://activemq.apache.org/stomp.html</a> for a description</p></pre>schoenobates: <pre><p>This library <a href="https://godoc.org/github.com/jjeffery/stomp" rel="nofollow">https://godoc.org/github.com/jjeffery/stomp</a> seems to let you set subscribe option headers:</p> <p><a href="https://godoc.org/github.com/jjeffery/stomp#Conn.Subscribe" rel="nofollow">https://godoc.org/github.com/jjeffery/stomp#Conn.Subscribe</a></p> <p>See example 2 - looking at the spec, I&#39;m guessing these selectors are server specific?</p> <p><a href="http://stomp.github.io/stomp-specification-1.1.html#SUBSCRIBE" rel="nofollow">http://stomp.github.io/stomp-specification-1.1.html#SUBSCRIBE</a></p></pre>salopru: <pre><p>Great, thank you! This works:</p> <pre><code>amqSelector = `_category=&#39;books&#39; AND _attr=&#39;title&#39;` sub, err := conn.Subscribe(&#34;/queue/SomeQueue&#34;, stomp.AckClient, stomp.SubscribeOpt.Header(&#34;selector&#34;, amqSelector)) </code></pre></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1235 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传