org.olat.commons.coordinate.cluster.jms
Class ClusterEventBus

java.lang.Object
  extended by org.olat.core.util.event.AbstractEventBus
      extended by org.olat.commons.coordinate.cluster.jms.ClusterEventBus
All Implemented Interfaces:
javax.jms.MessageListener, EventBus, GenericEventListener

public class ClusterEventBus
extends AbstractEventBus
implements javax.jms.MessageListener, GenericEventListener

This class realizes a clustered (multiple java vm) system event bus. it uses JMS (per default, apache activeMQ 4.1.4 is configured using spring) as an implementation.

Author:
Felix Jost

Method Summary
 void event(Event event)
           
 void fireEventToListenersOf(MultiUserEvent event, OLATResourceable ores)
          fires an event to all listeners interested in events concerning this OLATResourceable ores.
 javax.management.openmbean.CompositeDataSupport getForeignClusterNodeStatistics()
          [used by jmx] cluster:::: to be improved: this is just a quick solution to output all data from all nodes
 long getLatestSentMsgId()
          [used by spring to auto export mbean data]
 int getListeningIdentityCntFor(OLATResourceable ores)
          this implementation must sum up all counts from all cluster nodes to return the correct number.
 SimpleProbe getMrtgProbeJMSDeliveryTime()
           
 SimpleProbe getMrtgProbeJMSEnqueueTime()
           
 SimpleProbe getMrtgProbeJMSLoad()
           
 SimpleProbe getMrtgProbeJMSProcessingTime()
           
 long getNumOfSentMessages()
          [used by spring to auto export mbean data]
 void onMessage(javax.jms.Message message)
          called by springs org.springframework.jms.listener.DefaultMessageListenerContainer, see coredefaultconfig.xml we receive a message here on the topic reserved for olat system bus messages.
 void setClusterConfig(ClusterConfig clusterConfig)
          [used by spring]
 void setConnectionFactory(javax.jms.ConnectionFactory conFac)
          [used by spring]
 void setDestination(javax.jms.Topic destination)
           
 void setJmsMsgDelayLimit(long jmsMsgDelayLimit)
          [used by spring]
 void setSendInterval(long sendInterval)
          [used by spring]
 void springInit()
           
 void stop()
          [used by spring]
 
Methods inherited from class org.olat.core.util.event.AbstractEventBus
deregisterFor, getListeningIdentityNamesFor, getUnmodifiableInfoCenter, registerFor, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

springInit

public void springInit()
                throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getMrtgProbeJMSDeliveryTime

public SimpleProbe getMrtgProbeJMSDeliveryTime()

getMrtgProbeJMSProcessingTime

public SimpleProbe getMrtgProbeJMSProcessingTime()

getMrtgProbeJMSLoad

public SimpleProbe getMrtgProbeJMSLoad()

getMrtgProbeJMSEnqueueTime

public SimpleProbe getMrtgProbeJMSEnqueueTime()

event

public void event(Event event)
Specified by:
event in interface GenericEventListener

getListeningIdentityCntFor

public int getListeningIdentityCntFor(OLATResourceable ores)
this implementation must sum up all counts from all cluster nodes to return the correct number.

Specified by:
getListeningIdentityCntFor in interface EventBus
Specified by:
getListeningIdentityCntFor in class AbstractEventBus
Parameters:
ores - the resourceable
Returns:
the number of people currently using this resource

fireEventToListenersOf

public void fireEventToListenersOf(MultiUserEvent event,
                                   OLATResourceable ores)
Description copied from interface: EventBus
fires an event to all listeners interested in events concerning this OLATResourceable ores. The events may be fired and received synchronously or asynchronously, depending on the concrete implementation.

Specified by:
fireEventToListenersOf in interface EventBus
Specified by:
fireEventToListenersOf in class AbstractEventBus
Parameters:
event - the OLATResourceableEvent (must be serializable!, for multiple server olat installations)
ores - the OLATResourceable
See Also:
org.olat.core.util.event.AbstractOLATSystemBus#fireEventToListenersOf(org.olat.core.util.event.MultiUserEvent, org.olat.core.id.OLATResourceable)

onMessage

public void onMessage(javax.jms.Message message)
called by springs org.springframework.jms.listener.DefaultMessageListenerContainer, see coredefaultconfig.xml we receive a message here on the topic reserved for olat system bus messages.

Specified by:
onMessage in interface javax.jms.MessageListener

setClusterConfig

public void setClusterConfig(ClusterConfig clusterConfig)
[used by spring]


getNumOfSentMessages

public long getNumOfSentMessages()
[used by spring to auto export mbean data]

Returns:
the number of sent cluster event bus message since startup of this java vm

getLatestSentMsgId

public long getLatestSentMsgId()
[used by spring to auto export mbean data]

Returns:
the id of the latest msg sent from this cluster

getForeignClusterNodeStatistics

public javax.management.openmbean.CompositeDataSupport getForeignClusterNodeStatistics()
[used by jmx] cluster:::: to be improved: this is just a quick solution to output all data from all nodes

Returns:
jmx-readable data of all statistics of all foreign cluster nodes

stop

public void stop()
[used by spring]


setSendInterval

public void setSendInterval(long sendInterval)
[used by spring]


setJmsMsgDelayLimit

public void setJmsMsgDelayLimit(long jmsMsgDelayLimit)
[used by spring]


setConnectionFactory

public void setConnectionFactory(javax.jms.ConnectionFactory conFac)
[used by spring]


setDestination

public void setDestination(javax.jms.Topic destination)