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


Java SimpMessageSendingOperations类代码示例

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


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

示例1: SimpAnnotationMethodMessageHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
/**
 * Create an instance of SimpAnnotationMethodMessageHandler with the given
 * message channels and broker messaging template.
 * @param clientInboundChannel the channel for receiving messages from clients (e.g. WebSocket clients)
 * @param clientOutboundChannel the channel for messages to clients (e.g. WebSocket clients)
 * @param brokerTemplate a messaging template to send application messages to the broker
 */
public SimpAnnotationMethodMessageHandler(SubscribableChannel clientInboundChannel,
		MessageChannel clientOutboundChannel, SimpMessageSendingOperations brokerTemplate) {

	Assert.notNull(clientInboundChannel, "clientInboundChannel must not be null");
	Assert.notNull(clientOutboundChannel, "clientOutboundChannel must not be null");
	Assert.notNull(brokerTemplate, "brokerTemplate must not be null");

	this.clientInboundChannel = clientInboundChannel;
	this.clientMessagingTemplate = new SimpMessagingTemplate(clientOutboundChannel);
	this.brokerTemplate = brokerTemplate;

	Collection<MessageConverter> converters = new ArrayList<MessageConverter>();
	converters.add(new StringMessageConverter());
	converters.add(new ByteArrayMessageConverter());
	this.messageConverter = new CompositeMessageConverter(converters);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:SimpAnnotationMethodMessageHandler.java

示例2: testHeadersToSend

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Test
public void testHeadersToSend() throws Exception {
	Message<?> inputMessage = createInputMessage("sess1", "sub1", "/app", "/dest", null);

	SimpMessageSendingOperations messagingTemplate = Mockito.mock(SimpMessageSendingOperations.class);
	SendToMethodReturnValueHandler handler = new SendToMethodReturnValueHandler(messagingTemplate, false);

	handler.handleReturnValue(PAYLOAD, this.noAnnotationsReturnType, inputMessage);

	ArgumentCaptor<MessageHeaders> captor = ArgumentCaptor.forClass(MessageHeaders.class);
	verify(messagingTemplate).convertAndSend(eq("/topic/dest"), eq(PAYLOAD), captor.capture());

	MessageHeaders messageHeaders = captor.getValue();
	SimpMessageHeaderAccessor accessor = getAccessor(messageHeaders, SimpMessageHeaderAccessor.class);
	assertNotNull(accessor);
	assertTrue(accessor.isMutable());
	assertEquals("sess1", accessor.getSessionId());
	assertNull("Subscription id should not be copied", accessor.getSubscriptionId());
	assertEquals(this.noAnnotationsReturnType, accessor.getHeader(SimpMessagingTemplate.CONVERSION_HINT_HEADER));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:21,代码来源:SendToMethodReturnValueHandlerTests.java

示例3: setUp

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	this.applicationContext = new StaticApplicationContext();
	this.applicationContext.registerSingleton("controller", TestController.class);
	this.applicationContext.registerSingleton("controllerAdvice", TestControllerAdvice.class);
	this.applicationContext.refresh();

	SubscribableChannel channel = Mockito.mock(SubscribableChannel.class);
	SimpMessageSendingOperations brokerTemplate = new SimpMessagingTemplate(channel);

	this.messageHandler = new TestWebSocketAnnotationMethodMessageHandler(brokerTemplate, channel, channel);
	this.messageHandler.setApplicationContext(this.applicationContext);
	this.messageHandler.afterPropertiesSet();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:15,代码来源:WebSocketAnnotationMethodMessageHandlerTests.java

示例4: PeerService

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Inject
public PeerService(NetworkParameters params,
                   PeerDiscovery peerDiscovery,
                   SimpMessageSendingOperations messagingTemplate) {
    super(params, peerDiscovery);
    this.messagingTemplate = messagingTemplate;
}
 
开发者ID:ConsensusJ,项目名称:consensusj,代码行数:8,代码来源:PeerService.java

示例5: OpenGamesForPlayerUpdatedPushNotificationHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Inject
public OpenGamesForPlayerUpdatedPushNotificationHandler(
        LoginRepository loginRepository,
        OpenGameForPlayerRepository openGameForUserRepository,
        SimpMessageSendingOperations messagingTemplate) {
    this.loginRepository = loginRepository;
    this.openGameForUserRepository = openGameForUserRepository;
    this.messagingTemplate = messagingTemplate;
}
 
开发者ID:cwoolner,项目名称:flex-poker,代码行数:10,代码来源:OpenGamesForPlayerUpdatedPushNotificationHandler.java

示例6: TableUpdatedPushNotificationHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Inject
public TableUpdatedPushNotificationHandler(
        SimpMessageSendingOperations messagingTemplate,
        TableRepository tableRepository) {
    this.messagingTemplate = messagingTemplate;
    this.tableRepository = tableRepository;
}
 
开发者ID:cwoolner,项目名称:flex-poker,代码行数:8,代码来源:TableUpdatedPushNotificationHandler.java

示例7: BookingRestController

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Autowired
BookingRestController(
        @Qualifier("reservationPool") TaskScheduler taskScheduler,
        BookingRepository bookingRepository,
        SimpMessageSendingOperations messagingTemplate) {
    this.messagingTemplate = messagingTemplate;
    this.taskScheduler = (taskScheduler);
    this.bookingRepository = bookingRepository;
}
 
开发者ID:joshlong,项目名称:boot-examples,代码行数:10,代码来源:Application.java

示例8: TailService

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Autowired
public TailService(@Value("${geoip2.cityfile}") String cityFile,
		@Value("${access.logs}") String accessLogs,
		SimpMessageSendingOperations messagingTemplate) {
	this.messagingTemplate = messagingTemplate;

	String databaseFile = cityFile;
	if (databaseFile != null) {
		Path database = Paths.get(databaseFile);
		if (Files.exists(database)) {
			try {
				this.reader = new DatabaseReader.Builder(database.toFile()).build();
			}
			catch (IOException e) {
				LoggerFactory.getLogger(getClass()).error("GeoIPCityService init", e);
			}
		}
	}

	this.tailers = new ArrayList<>();

	for (String logFile : accessLogs.split(",")) {
		Path p = Paths.get(logFile.trim());
		this.tailers.add(new Tailer(p.toFile(), new ListenerAdapter()));
	}

	this.executor = Executors.newFixedThreadPool(this.tailers.size());
	for (Tailer tailer : this.tailers) {
		this.executor.execute(tailer);
	}
}
 
开发者ID:ralscha,项目名称:spring4ws-demos,代码行数:32,代码来源:TailService.java

示例9: ActivityService

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public ActivityService(SimpMessageSendingOperations messagingTemplate) {
    this.messagingTemplate = messagingTemplate;
}
 
开发者ID:ElectronicArmory,项目名称:Armory,代码行数:4,代码来源:ActivityService.java

示例10: JoalMessageSendingTemplate

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public JoalMessageSendingTemplate(final SimpMessageSendingOperations messageSendingOperations) {
    this.messageSendingOperations = messageSendingOperations;
    this.replayablePayloads = new ArrayList<>(30);
    lock = new ReentrantReadWriteLock(true);
}
 
开发者ID:anthonyraymond,项目名称:joal,代码行数:6,代码来源:JoalMessageSendingTemplate.java

示例11: MessageController

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Autowired
public MessageController(ActiveWebSocketUserRepository activeUserRepository,
                         SimpMessageSendingOperations messagingTemplate) {
    this.activeUserRepository = activeUserRepository;
    this.messagingTemplate = messagingTemplate;
}
 
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:7,代码来源:MessageController.java

示例12: WebSocketConnectHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public WebSocketConnectHandler(SimpMessageSendingOperations messagingTemplate,
                               ActiveWebSocketUserRepository repository) {
    super();
    this.messagingTemplate = messagingTemplate;
    this.repository = repository;
}
 
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:7,代码来源:WebSocketConnectHandler.java

示例13: WebSocketDisconnectHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public WebSocketDisconnectHandler(SimpMessageSendingOperations messagingTemplate,
                                  ActiveWebSocketUserRepository repository) {
    super();
    this.messagingTemplate = messagingTemplate;
    this.repository = repository;
}
 
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:7,代码来源:WebSocketDisconnectHandler.java

示例14: webSocketConnectHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Bean
public WebSocketConnectHandler<S> webSocketConnectHandler(
    SimpMessageSendingOperations messagingTemplate,
    ActiveWebSocketUserRepository repository) {
    return new WebSocketConnectHandler<S>(messagingTemplate, repository);
}
 
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:7,代码来源:WebSocketHandlersConfig.java

示例15: webSocketDisconnectHandler

import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Bean
public WebSocketDisconnectHandler<S> webSocketDisconnectHandler(
    SimpMessageSendingOperations messagingTemplate,
    ActiveWebSocketUserRepository repository) {
    return new WebSocketDisconnectHandler<S>(messagingTemplate, repository);
}
 
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:7,代码来源:WebSocketHandlersConfig.java


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