当前位置: 首页>>代码示例>>Java>>正文


Java SubscribeMapping类代码示例

本文整理汇总了Java中org.springframework.messaging.simp.annotation.SubscribeMapping的典型用法代码示例。如果您正苦于以下问题:Java SubscribeMapping类的具体用法?Java SubscribeMapping怎么用?Java SubscribeMapping使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SubscribeMapping类属于org.springframework.messaging.simp.annotation包,在下文中一共展示了SubscribeMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendActivity

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/topic/activity")
@SendTo("/topic/tracker")
public ActivityDTO sendActivity(@Payload ActivityDTO activityDTO, StompHeaderAccessor stompHeaderAccessor, Principal principal) {
    activityDTO.setUserLogin(SecurityUtils.getCurrentUserLogin());
    activityDTO.setUserLogin(principal.getName());
    activityDTO.setSessionId(stompHeaderAccessor.getSessionId());
    activityDTO.setIpAddress(stompHeaderAccessor.getSessionAttributes().get(IP_ADDRESS).toString());
    Instant instant = Instant.ofEpochMilli(Calendar.getInstance().getTimeInMillis());
    activityDTO.setTime(dateTimeFormatter.format(ZonedDateTime.ofInstant(instant, ZoneOffset.systemDefault())));
    log.debug("Sending user tracking data {}", activityDTO);
    return activityDTO;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:13,代码来源:ActivityService.java

示例2: onSubscribe

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/queue/output")
public GameOutput onSubscribe(Principal principal,
                              @Header("breadcrumb") String breadcrumb,
                              @Header("simpSessionId") String simpSessionId) {
    Session session = getSessionFromPrincipal(principal);
    Map<String, String> sessionMap = session.getAttribute(breadcrumb);
    Entity entity = entityRepository.findOne(sessionMap.get("entity"));

    entity.setStompUsername(principal.getName());
    entity.setStompSessionId(simpSessionId);
    entity = entityRepository.save(entity);

    GameOutput output = new GameOutput();

    output.append("[black]  ___                            _   __  __ _   _ ___  ".replace(" ", "&nbsp;"));
    output.append("[dwhite] | __|_ __  ___ _ _ __ _ ___ _ _| |_|  \\/  | | | |   \\ ".replace(" ", "&nbsp;"));
    output.append("[dwhite] | _|| '  \\/ -_) '_/ _` / -_) ' \\  _| |\\/| | |_| | |) |".replace(" ", "&nbsp;"));
    output.append("[white] |___|_|_|_\\___|_| \\__, \\___|_||_\\__|_|  |_|\\___/|___/ ".replace(" ", "&nbsp;"));
    output.append("[white]                   |___/                               ".replace(" ", "&nbsp;"));
    output.append("[white]Copyright &copy; 2016-2017 Peter Keeler.");
    output.append("[dwhite]EmergentMUD is licensed under the <a class=\"green\" target=\"_blank\" " +
            "href=\"http://www.gnu.org/licenses/agpl-3.0.en.html\">GNU Affero General Public License</a>.");
    output.append("[dwhite]EmergentMUD offers no warranties or guarantees. Play at your own risk.");
    output.append("[red]EmergentMUD is in early stages of development. Reboots and database wipes may occur without warning!");
    output.append("[dwhite]EmergentMUD is <a class=\"green\" target=\"_blank\" " +
            "href=\"https://github.com/scionaltera/emergentmud\">free, open source software</a> that " +
            "[white]you [dwhite]can contribute to, modify and distribute as you wish.");
    output.append("[dwhite]EmergentMUD server status:");
    output.append("[dwhite]&nbsp;&nbsp;Version: [white]v" + applicationVersion);
    output.append("[dwhite]&nbsp;&nbsp;Up since: [white]" + new DateTime(applicationBootDate));
    output.append(String.format("[yellow]Welcome to the world, %s!", entity.getName()));
    output.append("");

    Command command = (Command)applicationContext.getBean("lookCommand");
    command.execute(output, entity, "look", new String[0], "");

    promptBuilder.appendPrompt(output);

    return output;
}
 
开发者ID:scionaltera,项目名称:emergentmud,代码行数:41,代码来源:WebSocketResource.java

示例3: sendActivity

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/topic/activity")
@SendTo("/topic/tracker")
public ActivityDTO sendActivity(@Payload ActivityDTO activityDTO, StompHeaderAccessor stompHeaderAccessor, Principal principal) {
    activityDTO.setUserLogin(principal.getName());
    activityDTO.setSessionId(stompHeaderAccessor.getSessionId());
    activityDTO.setIpAddress(stompHeaderAccessor.getSessionAttributes().get(IP_ADDRESS).toString());
    activityDTO.setTime(Instant.now());
    log.debug("Sending user tracking data {}", activityDTO);
    return activityDTO;
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:11,代码来源:ActivityService.java

示例4: subscribeEventDestinationVariable

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/sub/{foo}/{name}")
public void subscribeEventDestinationVariable(@DestinationVariable("foo") String param1,
		@DestinationVariable("name") String param2) {
	this.method = "subscribeEventDestinationVariable";
	this.arguments.put("foo", param1);
	this.arguments.put("name", param2);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:SimpAnnotationMethodMessageHandlerTests.java

示例5: getJsonView

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/jsonview")	// not needed for the tests but here for completeness
@JsonView(MyJacksonView1.class)
public JacksonViewBean getJsonView() {
	JacksonViewBean payload = new JacksonViewBean();
	payload.setWithView1("with");
	payload.setWithView2("with");
	payload.setWithoutView("without");
	return payload;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:SubscriptionMethodReturnValueHandlerTests.java

示例6: sendActivity

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/topic/activity")
@SendTo("/topic/tracker")
public ActivityDTO sendActivity(@Payload ActivityDTO activityDTO, StompHeaderAccessor stompHeaderAccessor, Principal principal) {
    activityDTO.setUserLogin(SecurityUtils.getCurrentLogin());
    activityDTO.setUserLogin(principal.getName());
    activityDTO.setSessionId(stompHeaderAccessor.getSessionId());
    activityDTO.setIpAddress(stompHeaderAccessor.getSessionAttributes().get(IP_ADDRESS).toString());
    activityDTO.setTime(dateTimeFormatter.print(Calendar.getInstance().getTimeInMillis()));
    log.debug("Sending user tracking data {}", activityDTO);
    return activityDTO;
}
 
开发者ID:ServiceCutter,项目名称:ServiceCutter,代码行数:12,代码来源:ActivityService.java

示例7: subscriptionHandler

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@RolesAllowed("ROLE_ADMIN")
@SubscribeMapping("/logs")
public void subscriptionHandler() {
    if (configurationMediator.isClusterMode()) {
        clusterEventPublisher.logWatcherStarted();
    }
    logsWatcherService.start();
    logsWatcherService.sendLatestLogs();
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:10,代码来源:LogsController.java

示例8: sendActivity

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/topic/activity")
@SendTo("/topic/tracker")
public ActivityDTO sendActivity(@Payload ActivityDTO activityDTO, StompHeaderAccessor stompHeaderAccessor, Principal principal) {
  activityDTO.setUserLogin(SecurityUtil.getCurrentUserLogin());
  activityDTO.setUserLogin(principal.getName());
  activityDTO.setSessionId(stompHeaderAccessor.getSessionId());
  activityDTO.setIpAddress(stompHeaderAccessor.getSessionAttributes().get(ApplicationConstants.IP_ADDRESS).toString());
  Instant instant = Instant.ofEpochMilli(Calendar.getInstance().getTimeInMillis());
  activityDTO.setTime(dateTimeFormatter.format(ZonedDateTime.ofInstant(instant, ZoneOffset.systemDefault())));
  log.debug("Sending user tracking data {}", activityDTO);
  return activityDTO;
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:13,代码来源:ActivityService.java

示例9: changePlayerState

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/topic/player_commands")
@SendTo("/topic/player_events")
public PlayerSnapshotDTO changePlayerState(@Payload PlayerStateDTO stateDTO,
                                           StompHeaderAccessor stompHeaderAccessor, Principal principal) {

    return null;
}
 
开发者ID:xxmicloxx,项目名称:TSMusicBot,代码行数:8,代码来源:PlayerService.java

示例10: getlistEmail

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/email/list")
public List<EmailEntity> getlistEmail() {
	return emailService.findAllEmail();
}
 
开发者ID:dopse,项目名称:maildump,代码行数:5,代码来源:EmailController.java

示例11: getParticipants

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/participants/{id}")
public List<ParticipantState> getParticipants(@DestinationVariable String id){
    return loadOnlineParticipants(id);
}
 
开发者ID:peterjurkovic,项目名称:travel-agency,代码行数:5,代码来源:ConversationController.java

示例12: getConversations

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/conversations")
public List<Conversation> getConversations(){
    PageRequest req = PageRequest.of(0, 30, Direction.DESC, "date");
    return conversationRepository.findAll(req).getContent();
}
 
开发者ID:peterjurkovic,项目名称:travel-agency,代码行数:6,代码来源:ConversationController.java

示例13: subscribeMessages

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/users")
public List<String> subscribeMessages() throws Exception {
    return this.activeUserRepository.findAllActiveUsers();
}
 
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:5,代码来源:MessageController.java

示例14: supportsReturnType

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@Override
public boolean supportsReturnType(MethodParameter returnType) {
	return (returnType.getMethodAnnotation(SubscribeMapping.class) != null &&
			returnType.getMethodAnnotation(SendTo.class) == null &&
			returnType.getMethodAnnotation(SendToUser.class) == null);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:7,代码来源:SubscriptionMethodReturnValueHandler.java

示例15: getData

import org.springframework.messaging.simp.annotation.SubscribeMapping; //导入依赖的package包/类
@SubscribeMapping("/data") // not needed for the tests but here for completeness
private String getData() {
	return PAYLOAD;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:SubscriptionMethodReturnValueHandlerTests.java


注:本文中的org.springframework.messaging.simp.annotation.SubscribeMapping类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。