Can't publish messages to Artemis using Ruby Stomp Client

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Can't publish messages to Artemis using Ruby Stomp Client

akhettar
This post has NOT been accepted by the mailing list yet.
Hi

I am using Artemis 1.1.0 version and I am no longer able to send/publish messages to Artemis using Ruby stomp client - see below code snippet. I have also tried other protocols such as AMQP, MQTT none are working. I can successfully connect (connection is established), but when I publish the message nothing gets published or sent to the queue. I am not seeing anything in the logs visible  to indicate what's wrong. However if I switch to Apache ActiveMQ (any version, the latest works too) the below client works fine.

Have I missed anything? Your help is very much appreciated.

Regards,

Ayache


Log output at the start up of Artemis:

21:31:10,145 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
21:31:10,167 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=./data/journal,bindingsDirectory=./data/bindings,largeMessagesDirectory=./data/large-messages,pagingDirectory=./data/paging)
21:31:10,199 INFO  [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal
21:31:10,251 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
21:31:10,255 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
21:31:10,266 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
21:31:10,268 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
21:31:10,272 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
21:31:10,402 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
21:31:10,990 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: trying to deploy queue jms.queue.DLQ
21:31:11,056 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: trying to deploy queue jms.queue.ExpiryQueue
21:31:11,181 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:5672 for protocols [AMQP]
21:31:11,184 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:5445 for protocols [STOMP,HORNETQ]
21:31:11,187 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:1883 for protocols [MQTT]
21:31:11,189 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:61616 for protocols [STOMP,MQTT,AMQP,OPENWIRE,HORNETQ,CORE]
21:31:11,191 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at 0.0.0.0:61613 for protocols [STOMP]
21:31:11,191 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live

RUBY STOMP CLIENT

require 'test/unit'
require 'openssl-extensions'
require 'amqp'
require 'onstomp'

class MyTest < Test::Unit::TestCase

  # Called before every test method runs. Can be used
  # to set up fixture information.

  def setup

  end

  # Called after every test method runs. Can be used to tear
  # down fixture information.

  def teardown
    # Do nothing
  end

  # Fake test
  # def test_artemis_mqtt
  #   EventMachine.run do
  #     connection = AMQP.connect(:host => '127.0.0.1', :user =>'admin', :pass =>'admin')
  #     puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
  #
  #     channel  = AMQP::Channel.new(connection)
  #     queue    = channel.queue("PMR2MB", :auto_delete => true)
  #     exchange = channel.direct("")
  #
  #     queue.subscribe do |payload|
  #       puts "Received a message: #{payload}. Disconnecting..."
  #       connection.close { EventMachine.stop }
  #     end
  #
  #     exchange.publish "Hello, world!", :routing_key => queue.name
  #   end
  #
  # end

  def test_onStomp_client
    puts "Starting demo"
    puts "----------------------------"

    running = true
    client = OnStomp::Client.new("stomp://127.0.0.1:61613")
    client.connect

    puts "Connected to broker using protocol #{client.connection.version}"

    client.subscribe("/queue/onstomp_test") do |message|
      puts "Received: '#{message.body}'"
      if message.body == 'finished'
        running = false
      end
    end

    client.send("/queue/onstomp_test", "hello world")
    client.send("/queue/onstomp_test", "this is a simple demo of onstomp")
    client.send("/queue/onstomp_test", "finished")

    Thread.pass while running
    client.disconnect
    puts "----------------------------"
    puts "End of demo"
  end
end