I have the following method on a Spring @Controller:
@MessageMapping("/comment/{id}")
@SendTo("/topic/conversation/{id}")
public OperationResult<Comment> comment(Comment comment) throws Exception {
//call @Service to add comment
OperationResult<Comment> operationResult = commentService.comment(comment);
return operationResult;}
This will send updates to all the subscribers even if the operation was not successful (operationResult.success == false).
NB: OperationResult has a boolean field called 'success' to indicate whether the operation was successful or not.
Question: I want to find out how can I only send updates to subscribers if the operation was successful (without throwing an exception) and ensure that the client that sent the comment always gets the operationResult