Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void configureMessageBroker(MessageBrokerRegistry registry) {
- registry.enableStompBrokerRelay("/topic");
- registry.setApplicationDestinationPrefixes("/app");
- }
- @Override
- public void registerStompEndpoints(StompEndpointRegistry registry) {
- registry.addEndpoint("/ws")
- .withSockJS();
- }
- // app is application destination prefix
- client.subscribe('/app/notificator', ...);
- /topic/notificator/admin - if logged user is of role admin, or
- /topic/notificator/user - if logged user is of role user
- @Controller
- public class QueueController {
- @SubscribeMapping("/notificator")
- public String getNotificatorQueue(Principal principal) {
- String role = // get role from principal
- return "/topic/notificator/" + role;
- }
- }
Add Comment
Please, Sign In to add comment