stomp

How to send message to a specific subscription over spring websocket STOMP?

六月ゝ 毕业季﹏ 提交于 2021-02-19 08:31:40
问题 I am using STOMP over websockets with spring boot. Is there a possibility to send a message to a specific subscription? I subscribe to the STOMP endpoints using a STOMP header containing an id field according to the stomp documentation I want this id to be used to determine the clients who should receive a message, but spring seems not to use this id. I can not just use sendToUser because two clients can have the same user id e.g. if a user has two opened browser windows. Only one specific

WebSocket Stomp over SockJS - http custom headers

这一生的挚爱 提交于 2021-02-17 21:25:33
问题 I'm using stomp.js over SockJS in my javascript client. I'm connecting to websocket using stompClient.connect({}, function (frame) { stomp over sockJS connection has 2 http requests: request to /info http upgrade request the client sends all cookies. I would like to also send custom headers (e.g. XSRF header) but didn't find a way to do that. Will appreciate any help. 回答1: @Rohitdev So basically you can't send any HTTP headers using stompClient, because STOMP is layer over websockets, and

MQ简介

落花浮王杯 提交于 2021-02-14 17:54:47
MQ概述 MQ是Message Queue的简称,意为消息队列,从字面意思上可以理解MQ的是一个存放消息的容器,并且它的 数据结构为队列(FIFO先进先出) 。MQ一般应用于 应用解耦,异步处理提速,流量削峰 ,实现高性能,高可用,可伸缩和最终一致性架构。 在MQ中一般存在三种角色 Broker、生产者、消费者 ,在不同的MQ产品中,也会存在不同的其他角色,这里只简单介绍一下主要的三种角色的作用:Broker也就是MQ服务,用于将生产者发送过来的消息按照类型分类存放在不同的队列中;生产者(自己实现)用于将数据发送到Broker;消费者(自己实现)用于从消息队列中获取数据进行消费。 MQ的优势 1、应用解耦:解耦各个应用,提高系统的扩展性、容错性和可维护性;比如在电商系统中订单系统需要调用库存系统、支付系统、物流系统进行业务操作,假如库存系统宕机,那么整个系统将不可用。使用了MQ之后,订单系统与库存系统的耦合度降低,库存系统挂掉不会影响订单主业务流程。 原始架构 MQ架构 2、异步提速:提高接口响应速度和系统吞吐量,提升用户体验;在分布式架构中,我们经常使用http、rpc等方式进行服务间的接口调用,那么假如订单系统调用库存系统修改库存需要300ms,成功修改库存后再调用支付系统进行支付需要300ms,最后支付完成调用物流系统进行发货需要300ms,再加上订单入库需要50ms

Connecting and sending message between Spring WebSocket instances

柔情痞子 提交于 2021-02-08 10:48:32
问题 I have multiple instances using Spring Boot WebSocket (created following the first half of Spring's guide). I need them to connect to other instances at specific hostnames and ports and to be able to send messages over the websocket connection using STOMP protocol. How can I connect to my other services over websocket? How can I send messages using the STOMP protocol (preferably using the same marshalling/unmarshalling magic I get with received messages)? Things that don't answer my question:

stomp/sockjs 404 not found error in jboss 6.4

穿精又带淫゛_ 提交于 2021-02-08 03:08:25
问题 I m trying to deploy spring-websocket-portfolio sample app wich use stomp/sockjs client with spring j2ee server . the same war package succeed in Tomcat7 and failed in jboss 6.4 and Tomcat6 with 404 error code . The error in chrome console is : sockjs.js:1622 GET http://localhost:8080/spring-websocket-portfolio/portfolio/info?t=1466117690528 404 (Not Found) Any idea ? 回答1: Your server needs to be Servlet 3.0+ and should support the websocket API. You'll find the list of officially supported

Spring websocket: how to send to all subscribers except the message sender

安稳与你 提交于 2021-01-29 21:02:49
问题 I am following the quick-start guide on Spring websocket with sockJs and Stomp here: https://spring.io/guides/gs/messaging-stomp-websocket/ At this point, my code looks like to one from guide and works as intended. I have a controller class with a method accepting incoming messages and sending them back to all who subscribed on the topic. What I want to do, is to change the code, so my @MessageMapping annotated method sends response to all subscribers excluding the one who send the message to

Spring websocket: how to send to all subscribers except the message sender

…衆ロ難τιáo~ 提交于 2021-01-29 18:34:06
问题 I am following the quick-start guide on Spring websocket with sockJs and Stomp here: https://spring.io/guides/gs/messaging-stomp-websocket/ At this point, my code looks like to one from guide and works as intended. I have a controller class with a method accepting incoming messages and sending them back to all who subscribed on the topic. What I want to do, is to change the code, so my @MessageMapping annotated method sends response to all subscribers excluding the one who send the message to

Unable to subscribe on topic using @stomp/stompjs

柔情痞子 提交于 2021-01-29 08:27:55
问题 Here is a part of my React component: import React from 'react'; import { Client } from '@stomp/stompjs'; class Balance extends React.Component { componentDidMount() { const client = new Client({ brokerURL: 'ws://localhost:8080/stomp', debug: (str) => { console.log(str); }, }); client.onConnect(() => { console.log('onConnect'); client.subscribe('/topic/balance', message => { console.log(message); }) }); client.activate(); } ... It looks like connection was established according to the debug

ActiveMQ JobScheduler remove message

廉价感情. 提交于 2021-01-28 17:36:35
问题 Is it possible to subscribe from PHP via Stomp to an ActiveMQ broker and access the JobScheduler (and subsequently remove a scheduled message by its jobId)? I have a set of scheduled messages for a queue "PROD" produced from 2 web servers, and upon the occurrence of an event on the same web server (aware of jobIds), would like to remove them from the JobScheduler so that the consumers (written in Java and located on multiple remote servers) don't receive them. I'm using ActiveMQ broker v5.9.1