1

I am new to Stomp ActiveMQ. I want to create a login from an android client and I don't know how to use ActiveMq. I\ve installed active mq, configured stomp and run the stompexample. 1. I have an error when running activemq from command line if I add in in the activemq.xml the following line:

 <transportConnector name="stomp+nio" uri="stomp+nio://localhost:61612"/>
            <transportConnector name="stomp+ssl" uri="stomp+ssl://localhost:61612"/>
  1. Can someone please explain what is with tx1 and tx2? Is there a way to send on the queue a message to a specific client? how?

    connection.connect("system", "manager");

        connection.begin("tx1");
        connection.send("/queue/test", "message1");
        connection.send("/queue/test", "message2");
        connection.commit("tx1");
    
        connection.subscribe("/queue/test", Subscribe.AckModeValues.CLIENT);
    
        connection.begin("tx2");
    
        StompFrame message = connection.receive();
        System.out.println(message.getBody());
        connection.ack(message, "tx2");
    
        message = connection.receive();
        System.out.println(message.getBody());
        connection.ack(message, "tx2");
    
        connection.commit("tx2");
    
        connection.disconnect();
    
  2. Can someone please tell me how to create an application that sends on a queue a text containing username, password and receives an answer if the register was successful?

user1165435
  • 231
  • 2
  • 4
  • 11

1 Answers1

1

You need to configure the transport connectors with different port numbers, they can't both share port 61612. Your configure is create a Stomp NIO connector and a different Stomp SSL Connector.

You can't send messages to a distinct client, you just place them on a Queue and if there is a client subscribed it will get the message, that's the nature of Queue based messaging. The TX1 TX2 stuff is sending the messages within a transaction.

Recommend you take some time to read up of JMS Messaging, the Stomp spec and some other messaging based tutorials.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • could you post some tutorials with stomp? are there any examples with android client? i did a search but i didn't find anything on andrid - android example. – user1222905 Jun 06 '12 at 11:33
  • also is there a way to combine stomp with jms? if for example from android (stomp) i post on a queue eg:test a message i would like on the "server side" (jms receiver) to get the message. is it possible? – user1222905 Jun 06 '12 at 11:36
  • It's pretty much possible to mix STOMP and JMS. I think you just need to go over some more tutorials about STOMP & JMS to understand these better. – Buchi Jun 12 '12 at 10:17