We are integrating spring web sockets into our application and I ran the hello world example and it is amazing that spring wires up everything for us to push server side notifications to the client side.
However I have some simple questions
1) How do the queues get created? I am using ActiveMQ and the queue names are different(e.g. like greetings-user3n9_jn3i) then what I specify in the destinations for e.g.
simpMessageSendingOperations.convertAndSend("/test/greeting", new Greeting("Hello Socket Listener!"));
2) Is the destination name different from a queue?
3) I am creating new queues using ActiveMQ console for e.g. /test1/greeting and sending I am subscribing to them in the client side as shown
var stompClient = null;
connect();
function connect() {
var socket = new SockJS(stompUrl);
stompClient = Stomp.over(socket);
stompClient.connect({}, function(frame) {
console.log('Connected: ' + frame);
stompClient.subscribe('/user/queue/greetings', function(greeting){
alert(greeting);
});
});
}
function disconnect() {
if (stompClient != null) {
stompClient.disconnect();
}
setConnected(false);
console.log("Disconnected");
}
$("#lstnMsgsBtn").click(function() {
$.ajax({
url: testUrl,
type: "POST",
success: function(data) {
var queueName = data.queueName;
stompClient.subscribe(queueName, function(greeting){
alert(greeting);
});
},
error : function(jqXhr, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
I am unable to subscribe to the queueName, I am pretty sure I am thinking in a wrong way, any pointers will be greatly appreciated.