У меня есть проект MVC, что делать нижеSpring Integration для SimpMessagingTemplate
@Autowired
SimpMessagingTemplate messagingTemplate;
private void sendAlarmUpdate(AlarmNotify alarmNotify) {
messagingTemplate.convertAndSend("/topic/notify/alarm",alarmNotify);
}
Я пытаюсь преобразовать это в Спринг интеграции с помощью int-stomp:outbound-channel-adapter
, но я получаю исключение, что полезная нагрузка сообщения должен быть массив байтов, я пытался преобразовать мой объект в JSON, но все тот же, что такое правильный способ, чтобы отправить сообщение ТОПАЙТЕ JSON с пружинным интеграции
@Bean
public Reactor2TcpStompClient stompClient() {
Reactor2TcpStompClient stompClient = new Reactor2TcpStompClient("192.168.70.XXX", 61613);
//stompClient.setMessageConverter(new PassThruMessageConverter());
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.afterPropertiesSet();
stompClient.setTaskScheduler(taskScheduler);
stompClient.setReceiptTimeLimit(5000);
return stompClient;
}
@Bean
public StompSessionManager stompSessionManager() {
Reactor2TcpStompSessionManager stompSessionManager = new Reactor2TcpStompSessionManager(stompClient());
stompSessionManager.setAutoReceipt(true);
return stompSessionManager;
}
<int:chain input-channel="stompChannel">
<!--<int:object-to-json-transformer />-->
<int-stomp:outbound-channel-adapter stomp-session-manager="stompSessionManager" destination="/topic/notify/alarm1" id="stompAdapter" />
</int:chain>