I'm a newbie in Spring framework. I already have a Spring service which sends some requests to /topic/liveFeed
. Here is the code for the existing service I have
public class DataPublisher {
@Autowired private SimpMessagingTemplate webSocket;
@Scheduled(fixedRate = 1000)
public void publish() throws Exception {
...
webSocket.convertAndSend("/topic/liveFeed", currentTick);
}
}
and in my app.js
I have
function connect() {
var socket = new SockJS('/stocks');
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame) {
setConnected(true);
console.log('Connected: ' + frame);
stompClient.subscribe('/topic/liveFeed', function (tick) {
console.log(tick)
});
});
}
So, it looks like this service is sending requests to /topic/liveFeed
, so I need to create another service which listens to /topic/liveFeed
and process the requests. Can someone help where should I start and what other components I need?