org.jboss.soa.esb.listeners.message
Class ServiceMessageCounter

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.jboss.soa.esb.listeners.message.ServiceMessageCounter
All Implemented Interfaces:
java.io.Serializable, javax.management.DynamicMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

public class ServiceMessageCounter
extends javax.management.NotificationBroadcasterSupport
implements javax.management.DynamicMBean, java.io.Serializable

Service message counter is a MBean that displays an action-by-action breakdown of how many failed and successful messages have been processed and shows the processing time of each. Alert thresholds have also been added to this bean. There are thresholds on the size of the message as well as the length of the message for both services and for individual actions. The alerts will produce a log4j warning as well as provide for the option of JMX integration with other products.

Since:
Version 4.2
Author:
tcunning@redhat.com
See Also:
Serialized Form

Field Summary
static java.lang.String ACTION_LENGTH_NOTIFICATION_TYPE
           
static java.lang.String ACTION_TIME_NOTIFICATION_TYPE
           
static java.lang.String RESET_COUNTER
           
static java.lang.String SERVICE_LENGTH_NOTIFICATION_TYPE
           
static java.lang.String SERVICE_TIME_NOTIFICATION_TYPE
           
 
Constructor Summary
ServiceMessageCounter(ConfigTree f_config, java.lang.String objectName)
          Constructor
 
Method Summary
 void alertAction(ActionStatusBean asb, java.lang.String actionName)
           
 void alertService(ActionStatusBean asb)
           
 java.lang.Long getActionAlertLength()
          Action alert length getter
 java.lang.Long getActionAlertTime()
          Action alert time getter
 java.lang.Long getAlertLength()
          Service alert length getter
 java.lang.Long getAlertTime()
          Service alert time getter
 java.lang.Object getAttribute(java.lang.String key)
           
 javax.management.AttributeList getAttributes(java.lang.String[] arg0)
           
 java.lang.String getDescription()
           
 javax.management.MBeanInfo getMBeanInfo()
          This creates the MBeanInfo object provided.
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
           
protected  javax.management.ObjectName getObjectName()
           
 void incrementTotalCount()
          Increment the total message count of this service.
 java.lang.Object invoke(java.lang.String method, java.lang.Object[] arg1, java.lang.String[] arg2)
           
 boolean isAlertsEnabled()
           
protected  void registerMBean()
          Register this MBean with JBoss.
 void resetCounter()
          Reset the counters - set all the entries in the action counter hash and in the action process time hash to zero.
 void setActionAlertLength(java.lang.Long alertLength)
          Action alert length setter
 void setActionAlertTime(java.lang.Long alertTime)
          Action alert time setter
 void setAlertLength(java.lang.Long alertLength)
          Service alert length setter
 void setAlertTime(java.lang.Long alertTime)
          Service alert time setter
 void setAttribute(javax.management.Attribute arg0)
           
 javax.management.AttributeList setAttributes(javax.management.AttributeList arg0)
           
 void setServiceDescription(java.lang.String serviceDescription)
           
protected  void unregisterMBean()
          Unregister this MBean with JBoss.
 void update(ActionStatusBean asb)
          Update the ServiceMessageCounter
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_LENGTH_NOTIFICATION_TYPE

public static final java.lang.String SERVICE_LENGTH_NOTIFICATION_TYPE
See Also:
Constant Field Values

SERVICE_TIME_NOTIFICATION_TYPE

public static final java.lang.String SERVICE_TIME_NOTIFICATION_TYPE
See Also:
Constant Field Values

ACTION_LENGTH_NOTIFICATION_TYPE

public static final java.lang.String ACTION_LENGTH_NOTIFICATION_TYPE
See Also:
Constant Field Values

ACTION_TIME_NOTIFICATION_TYPE

public static final java.lang.String ACTION_TIME_NOTIFICATION_TYPE
See Also:
Constant Field Values

RESET_COUNTER

public static final java.lang.String RESET_COUNTER
See Also:
Constant Field Values
Constructor Detail

ServiceMessageCounter

public ServiceMessageCounter(ConfigTree f_config,
                             java.lang.String objectName)
Constructor

Parameters:
f_config - config tree
objectName - The name to use as the MBean.
Method Detail

getDescription

public java.lang.String getDescription()

setServiceDescription

public void setServiceDescription(java.lang.String serviceDescription)

getAlertTime

public java.lang.Long getAlertTime()
Service alert time getter

Returns:
max message processing time for the service before an alert is fired

setAlertTime

public void setAlertTime(java.lang.Long alertTime)
Service alert time setter

Parameters:
alertTime - max message size passing through service before an alert is fired

getAlertLength

public java.lang.Long getAlertLength()
Service alert length getter

Returns:
max length of message passing through service before an alert is fired

setAlertLength

public void setAlertLength(java.lang.Long alertLength)
Service alert length setter

Parameters:
alertLength - max message processing time for the service before an alert is fired

getActionAlertTime

public java.lang.Long getActionAlertTime()
Action alert time getter

Returns:
max message processing time before an alert is fired

setActionAlertTime

public void setActionAlertTime(java.lang.Long alertTime)
Action alert time setter

Parameters:
alertLength - max time (ms) the action can take before an alert is fired.

getActionAlertLength

public java.lang.Long getActionAlertLength()
Action alert length getter

Returns:
max message size passing through action before an alert is fired

setActionAlertLength

public void setActionAlertLength(java.lang.Long alertLength)
Action alert length setter

Parameters:
alertLength - max message size passing through action before an alert is fired

incrementTotalCount

public void incrementTotalCount()
Increment the total message count of this service.


resetCounter

public void resetCounter()
Reset the counters - set all the entries in the action counter hash and in the action process time hash to zero.


getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()
This creates the MBeanInfo object provided. We are returning generic text for the attribute descriptions (the word Property and the name of the attribute), all of the attributes are read-only, and we provide four invocation methods - start/stop/initialise/destroy on the Lifecycle.

Specified by:
getMBeanInfo in interface javax.management.DynamicMBean

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
                              throws javax.management.AttributeNotFoundException,
                                     javax.management.MBeanException,
                                     javax.management.ReflectionException
Specified by:
getAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] arg0)
Specified by:
getAttributes in interface javax.management.DynamicMBean

invoke

public java.lang.Object invoke(java.lang.String method,
                               java.lang.Object[] arg1,
                               java.lang.String[] arg2)
                        throws javax.management.MBeanException,
                               javax.management.ReflectionException
Specified by:
invoke in interface javax.management.DynamicMBean
Throws:
javax.management.MBeanException
javax.management.ReflectionException

setAttribute

public void setAttribute(javax.management.Attribute arg0)
                  throws javax.management.AttributeNotFoundException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         javax.management.ReflectionException
Specified by:
setAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
javax.management.ReflectionException

setAttributes

public javax.management.AttributeList setAttributes(javax.management.AttributeList arg0)
Specified by:
setAttributes in interface javax.management.DynamicMBean

registerMBean

protected void registerMBean()
Register this MBean with JBoss.


unregisterMBean

protected void unregisterMBean()
Unregister this MBean with JBoss.


alertService

public void alertService(ActionStatusBean asb)

isAlertsEnabled

public boolean isAlertsEnabled()

alertAction

public void alertAction(ActionStatusBean asb,
                        java.lang.String actionName)

update

public void update(ActionStatusBean asb)
Update the ServiceMessageCounter

Parameters:
asb - ActionStatusBean

getObjectName

protected javax.management.ObjectName getObjectName()

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster
Overrides:
getNotificationInfo in class javax.management.NotificationBroadcasterSupport