My Java Code which intercepts all the calls with the URL /hello (Back) :
@Controller
public class GreetingController {
@MessageMapping("/hello")
@SendTo("/topic/greetings")
public Greeting greeting(HelloMessage message) throws Exception {
Thread.sleep(3000); // simulated delay
return new Greeting("Hello, " + message.getName() + "!");
}
}
My JavaScript code which calls the method greeting() (Front) :
function sendName() {
var name = document.getElementById('name').value;
stompClient.send("/app/hello", {}, JSON.stringify({ 'name': name }));
}
Can some one please let me know how can I invoke @MessageMapping("/hello") method from Rest client. I can able to connect through JavaScript code and even getting response and displaying it in HTML. But I have a requirement where external system(through rest call) should invoke this @MessageMapping("/hello") and then application(backend) should send response to HTML. I tried to invoke @MessageMapping("/hello") method from chrome rest client plugin but was unsuccessful.
Please let me know how to invoke this method? Thanks in advance