本文整理汇总了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);
}
示例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));
}
示例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;
}
示例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;
}
示例6: TableUpdatedPushNotificationHandler
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Inject
public TableUpdatedPushNotificationHandler(
SimpMessageSendingOperations messagingTemplate,
TableRepository tableRepository) {
this.messagingTemplate = messagingTemplate;
this.tableRepository = tableRepository;
}
示例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;
}
示例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);
}
}
示例9: ActivityService
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public ActivityService(SimpMessageSendingOperations messagingTemplate) {
this.messagingTemplate = messagingTemplate;
}
示例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);
}
示例11: MessageController
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Autowired
public MessageController(ActiveWebSocketUserRepository activeUserRepository,
SimpMessageSendingOperations messagingTemplate) {
this.activeUserRepository = activeUserRepository;
this.messagingTemplate = messagingTemplate;
}
示例12: WebSocketConnectHandler
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public WebSocketConnectHandler(SimpMessageSendingOperations messagingTemplate,
ActiveWebSocketUserRepository repository) {
super();
this.messagingTemplate = messagingTemplate;
this.repository = repository;
}
示例13: WebSocketDisconnectHandler
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
public WebSocketDisconnectHandler(SimpMessageSendingOperations messagingTemplate,
ActiveWebSocketUserRepository repository) {
super();
this.messagingTemplate = messagingTemplate;
this.repository = repository;
}
示例14: webSocketConnectHandler
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Bean
public WebSocketConnectHandler<S> webSocketConnectHandler(
SimpMessageSendingOperations messagingTemplate,
ActiveWebSocketUserRepository repository) {
return new WebSocketConnectHandler<S>(messagingTemplate, repository);
}
示例15: webSocketDisconnectHandler
import org.springframework.messaging.simp.SimpMessageSendingOperations; //导入依赖的package包/类
@Bean
public WebSocketDisconnectHandler<S> webSocketDisconnectHandler(
SimpMessageSendingOperations messagingTemplate,
ActiveWebSocketUserRepository repository) {
return new WebSocketDisconnectHandler<S>(messagingTemplate, repository);
}