【问题标题】:using ruby and stomp to write messages to ActiveMQ使用 ruby​​ 和 stomp 将消息写入 ActiveMQ
【发布时间】:2011-12-24 10:18:17
【问题描述】:

我正在使用 stomp 从 Ruby 向 ActiveMQ 写入消息。我在下面的例子 http://calliopesounds.blogspot.com/2009/07/working-ruby-stomp-example.html

但我收到以下错误,不知道是什么问题

/Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:462:in `write': Invalid argument (Errno::EINVAL)
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:462:in `puts'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:462:in `_transmit'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:462:in `each'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:462:in `_transmit'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:445:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:445:in `_transmit'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:427:in `transmit'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/connection.rb:267:in `publish'
    from /Library/Ruby/Gems/1.8/gems/stomp-1.1.10/lib/stomp/client.rb:200:in `publish'
    from utils.rb:10

这是脚本

require 'rubygems'
require 'stomp'

queue = "/queue/msg.in"

puts "Producer for queue #{queue}"

client = Stomp::Client.open "stomp://localhost:61616"
puts client
client.publish queue, "hello!"
client.close

【问题讨论】:

    标签: ruby activemq stomp


    【解决方案1】:

    这可能不是您的确切问题,但由于发送时代码阻塞,它可能是类似的。

    默认情况下 localhost:61616 是 AMQ 代理监听 openwire 连接的地方。您是否更改了代理 xml config 以在该端口上使用 stomp? 配置应该有一个类似的条目:

    <transportConnectors>
       <transportConnector name="stomp" uri="stomp://localhost:61613"/>
    </transportConnectors>
    

    【讨论】:

      猜你喜欢
      • 2018-10-31
      • 2019-08-18
      • 2021-11-22
      • 2019-09-29
      • 2015-07-15
      • 2018-07-19
      • 2018-08-22
      • 2019-02-08
      • 2011-07-15
      相关资源
      最近更新 更多