Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing JMX / JMS to broadcast a message to all sessions of a web app?
    primarykey
    data
    text
    <p>I have a Spring MVC web app running on my server. Recently I wanted to add a functionality to notify any logged in users that their role has changed, so they can logout and in again.</p> <p>I thought about using JMX, so did a small test and it worked fine, except that its not broadcasting the message. So for example, if i have 2 logged in persons, only 1 is receiving the message.</p> <p>So my question is, is it possible to broadcast a message with JMX to all instances of a web app (active sessions)?</p> <p>Edit - using JMS</p> <p>So I am trying with JMS right now, here is my configuration file:</p> <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"&gt; &lt;bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt; &lt;property name="brokerURL" value="tcp://localhost:61616"/&gt; &lt;/bean&gt; &lt;bean id="msgDestination" class="org.apache.activemq.command.ActiveMQTopic"&gt; &lt;constructor-arg value="userToLogout.topic"/&gt; &lt;/bean&gt; &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt; &lt;property name="connectionFactory" ref="connectionFactory"/&gt; &lt;property name="pubSubDomain" value="true"/&gt; &lt;property name="receiveTimeout" value="10000"/&gt; &lt;/bean&gt; &lt;bean id="userNotifier" class="com.cap.messaging.UserNotifier"&gt; &lt;property name="destination" ref="msgDestination"/&gt; &lt;property name="jmsTemplate" ref="jmsTemplate"/&gt; &lt;/bean&gt; &lt;bean id="userNotificationListener" class="com.cap.messaging.UserNotificationListener"&gt; &lt;/bean&gt; &lt;bean class="org.springframework.jms.listener.DefaultMessageListenerContainer"&gt; &lt;property name="connectionFactory" ref="connectionFactory" /&gt; &lt;property name="destinationName" value="userToLogout.topic" /&gt; &lt;property name="messageListener" ref="userNotificationListener" /&gt; &lt;/bean&gt; </code></pre> <p></p> <p>This isnt working right now. However it works if I change the ActiveMQTopic to ActiveMQQueue. what am I missing here, and would this work?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload