1 2 Previous Next 15 Replies Latest reply on Oct 8, 2014 3:57 PM by jbertram Go to original post
      • 15. Re: Re: STOMP destination naming issue
        jbertram

        What I don't understand is why the stomp is strongly coupled to jms.

        Our STOMP implementation is not strongly coupled with our JMS implementation.  The only reason why you would necessarily want to send a STOMP message to an address that starts with "jms.queue." or "jms.topic." is so that a JMS client could consume it.  You can consume a STOMP message from any core address you like.  For example, I just added a this to org.hornetq.tests.integration.stomp.StompTest and it worked fine:

         

           @Test
           public void testSendWithCoreAndReceiveWithSTOMP() throws Exception
           {
              final String QUEUE_NAME = "myQueue";
              ServerLocator locator = HornetQClient.createServerLocator(false, new TransportConfiguration(InVMConnectorFactory.class.getName()));
              ClientSessionFactory clientSessionFactory = locator.createSessionFactory();
              ClientSession clientSession = clientSessionFactory.createSession();
              clientSession.createQueue(QUEUE_NAME, QUEUE_NAME);
              ClientProducer clientProducer = clientSession.createProducer(QUEUE_NAME);
        
              String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
              sendFrame(frame);
        
              frame = receiveFrame(100000);
              Assert.assertTrue(frame.startsWith("CONNECTED"));
        
              frame = "SUBSCRIBE\n" + "destination:" + QUEUE_NAME + "\n" + "ack:auto\n\n" + Stomp.NULL;
              sendFrame(frame);
        
              ClientMessage clientMessage = clientSession.createMessage(true);
              clientMessage.getBodyBuffer().writeNullableSimpleString(new SimpleString("Hello World"));
              clientProducer.send(clientMessage);
              locator.close();
        
              frame = receiveFrame(10000);
              System.out.println(frame);
              Assert.assertTrue(frame.startsWith("MESSAGE"));
              Assert.assertTrue(frame.indexOf("destination:") > 0);
              Assert.assertTrue(frame.indexOf("Hello World") > 0);
        
              frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
              sendFrame(frame);
           }
        

         

        This test demonstrates a core client sending a message to the core address "myQueue" and then a STOMP client consuming that message from the queue "myQueue".

         

        I'm not a stomp expert in the team but my understanding is stomp should be independent from jms.

        Our STOMP implementation is independent of our JMS implementation.

         

        I could have a core client send a welcome msg with content "Welcome to My App" to address Welcome.Topic every 5 sec. On the other end stomp client just read and print it.

        Yes, this should be possible.  See the example I pasted above.

         

        But it seems the prefix is strongly forced (not like other recommendation).

        In what way is the prefix strongly forced?

         

        Perhaps this bit of documentation would help you?

        1 2 Previous Next