use of org.springframework.messaging.handler.annotation.MessageMapping in project 2017-01-HUDI-MAC-CHAR by NHNNEXT.
the class MessageHandler method broadcasting.
@MessageMapping("/ready/{roomId}")
@SendTo("/from/ready/{roomId}")
public ReadySignal broadcasting(ReadySignal ready, @DestinationVariable long roomId) throws Exception {
log.debug("ReadySignal arrived: /ready/{}, ready: {}", roomId, ready);
Room room = lobby.getRoom(roomId);
room.findByNickname(ready.getUserName()).toggleReady();
if (room.isAllReady()) {
ready.setStartTimer(true);
room.createGameManager();
}
return ready;
}
use of org.springframework.messaging.handler.annotation.MessageMapping in project 2017-01-HUDI-MAC-CHAR by NHNNEXT.
the class MessageHandler method broadcasting.
@MessageMapping("/access/{roomId}")
@SendTo("/from/access/{roomId}")
public ClientAccess broadcasting(ClientAccess access, @DestinationVariable long roomId) throws Exception {
log.debug("ClientAccess arrived: /access/{}, access: {}", roomId, access);
Room room = lobby.getRoom(roomId);
access.setUsers(room.getUsers());
return access;
}
use of org.springframework.messaging.handler.annotation.MessageMapping in project 2017-01-HUDI-MAC-CHAR by NHNNEXT.
the class MessageHandler method broadcasting.
@MessageMapping("/gameStart/{roomId}/{userName}")
@SendTo("/from/gameStart/{roomId}/{userName}")
public String broadcasting(GameStart gameStart, @DestinationVariable long roomId, @DestinationVariable String userName) throws Exception {
log.debug("GameStart arrived: /gameStart/{}/{}, gameStart: {}", roomId, userName, gameStart);
Room gameRoom = lobby.getRoom(roomId);
gameRoom.getUsers().forEach(user -> user.gameStart());
return gameRoom.getUserRoleNameInGame(userName);
}
use of org.springframework.messaging.handler.annotation.MessageMapping in project spring-framework by spring-projects.
the class RSocketMessageHandler method getCondition.
@Override
@Nullable
protected CompositeMessageCondition getCondition(AnnotatedElement element) {
MessageMapping ann1 = AnnotatedElementUtils.findMergedAnnotation(element, MessageMapping.class);
if (ann1 != null && ann1.value().length > 0) {
return new CompositeMessageCondition(RSocketFrameTypeMessageCondition.EMPTY_CONDITION, new DestinationPatternsMessageCondition(processDestinations(ann1.value()), obtainRouteMatcher()));
}
ConnectMapping ann2 = AnnotatedElementUtils.findMergedAnnotation(element, ConnectMapping.class);
if (ann2 != null) {
String[] patterns = processDestinations(ann2.value());
return new CompositeMessageCondition(RSocketFrameTypeMessageCondition.CONNECT_CONDITION, new DestinationPatternsMessageCondition(patterns, obtainRouteMatcher()));
}
return null;
}
use of org.springframework.messaging.handler.annotation.MessageMapping in project spring-framework by spring-projects.
the class MessageMappingMessageHandler method getCondition.
/**
* Determine the mapping condition for the given annotated element.
* @param element the element to check
* @return the condition, or {@code null}
*/
@Nullable
protected CompositeMessageCondition getCondition(AnnotatedElement element) {
MessageMapping ann = AnnotatedElementUtils.findMergedAnnotation(element, MessageMapping.class);
if (ann == null || ann.value().length == 0) {
return null;
}
String[] patterns = processDestinations(ann.value());
return new CompositeMessageCondition(new DestinationPatternsMessageCondition(patterns, obtainRouteMatcher()));
}
Aggregations