3 Replies Latest reply on Oct 9, 2012 4:36 PM by Steven Wisener

    Unable to receive messages with a durable subscription to a topic via STOMP

    Steven Wisener Newbie

      I am just getting started with HornetQ 2.3.0 Beta 1 using STOMP 1.1, and I am unable to receive messages with a durable subscription to a topic. I'm using the Ruby onstomp gem for my tests.

       

      h2. hornetq-jms.xml

       

      {code:xml}

      <topic name="TestTopic">

        <entry name="/topic/TestTopic"/>

      </topic>

      {code}

       

       

      h2. Producer code

       

      {code}

      require 'rubygems'

      require 'bundler/setup'

      require 'onstomp'

       

      client = OnStomp::Client.new('stomp://localhost')

      client.connect :login => 'guest', :passcode => 'guest'

       

      while true

        client.send 'jms.topic.TestTopic', 'some message...', :persistent => true

        sleep 5

      end

       

      client.disconnect

      {code}

       

      h2. Consumer code

       

      {code}

      require 'rubygems'

      require 'bundler/setup'

      require 'onstomp'

       

      client = OnStomp::Client.new('stomp://localhost')

       

      Signal.trap("INT") do

        client.disconnect

        exit

      end

       

      client.connect :login => 'guest', :passcode => 'guest', :'client-id' => 'test-client'

       

      client.subscribe('jms.topic.TestTopic',

                       :ack => 'client',

                       :'durable-subscriber-name' => 'test-client') do |message|

        client.ack message

        puts "OK: #{message.body}"

      end

       

      while true

        print '.'

        sleep 2

        client.beat

      end

      {code}

       

      h2. Server behavior

       

      This message appears in the HornetQ logs:

       

      {noformat}

      15:23:01,595 DEBUG [org.hornetq.core.server] Message ServerMessage[messageID=1472,priority=4, bodySize=512,expiration=0, durable=true, address=jms.topic.TestTopic,properties=TypedProperties[{JMSCorrelationID=null, content-type=text/plain;charset=US-ASCII, JMSType=null, content-length=15, destination=jms.topic.TestTopic}]]@1801199220 is not going anywhere as it didn't have a binding on address:jms.topic.TestTopic

      {noformat}

       

      If I remove the durable-subscriber-name header on the consumer, the message comes through.