[jboss-svn-commits] JBL Code SVN: r29531 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/common and 25 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 2 13:25:19 EDT 2009


Author: tcunning
Date: 2009-10-02 13:25:18 -0400 (Fri, 02 Oct 2009)
New Revision: 29531

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/META-INF/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/soa/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/soa/esb/samples/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/soa/esb/samples/quickstart/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/soa/esb/samples/quickstart/messagealerts/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build/classes/org/jboss/soa/esb/samples/quickstart/messagealerts/test/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/deployment.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbm-queue-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbmq-queue-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jboss-esb.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbossesb-properties.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jndi.properties
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/juddi.properties
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/lib/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/listener.log
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/log4j.xml
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/readme.txt
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/DelayAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/MyJMSListenerAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendEsbMessage.java
   labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendJMSMessage.java
Modified:
   labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/ActionMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/MapperUtil.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionStatusBean.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/Util.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java
Log:
JBESB-2585
Adding a service and an action length/time alert threshold.     The threshold
can be specified in jboss-esb.xml and the messagealerts quickstart demonstrates
its use and how it can be viewed in the server console.


Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd	2009-10-02 17:25:18 UTC (rev 29531)
@@ -350,6 +350,32 @@
                                         </xsd:restriction>
                                 </xsd:simpleType>
 			</xsd:attribute>
+			<xsd:attribute name="alertTimeThreshold"
+				use="optional">
+				<xsd:annotation>
+					<xsd:documentation xml:lang="en">
+						A value used for monitoring to produce alerts
+						if the service takes longer to complete than
+						the value of the field.
+					</xsd:documentation>
+				</xsd:annotation>
+				<xsd:simpleType>
+					<xsd:restriction base="xsd:decimal"/>
+				</xsd:simpleType>
+			</xsd:attribute>
+			<xsd:attribute name="alertLengthThreshold"
+				use="optional">
+				<xsd:annotation>
+					<xsd:documentation xml:lang="en">
+						A value used for monitoring to produce alerts
+						if the service takes longer to complete than
+						the value of the field.
+					</xsd:documentation>
+				</xsd:annotation>
+				<xsd:simpleType>
+					<xsd:restriction base="xsd:decimal"/>
+				</xsd:simpleType>
+			</xsd:attribute>
             <xsd:attribute name="invmScope" type="jesb:invmScope" use="optional">
                 <xsd:annotation>
                     <xsd:documentation xml:lang="en">
@@ -452,6 +478,32 @@
 					</xsd:documentation>
 				</xsd:annotation>
 			</xsd:attribute>
+			<xsd:attribute name="alertTimeThreshold"
+				use="optional">
+				<xsd:annotation>
+					<xsd:documentation xml:lang="en">
+						A value used for monitoring to produce alerts
+						if the service takes longer to complete than
+						the value of the field.
+					</xsd:documentation>
+				</xsd:annotation>
+				<xsd:simpleType>
+					<xsd:restriction base="xsd:decimal"/>
+				</xsd:simpleType>
+			</xsd:attribute>
+			<xsd:attribute name="alertLengthThreshold"
+				use="optional">
+				<xsd:annotation>
+					<xsd:documentation xml:lang="en">
+						A value used for monitoring to produce alerts
+						if the service takes longer to complete than
+						the value of the field.
+					</xsd:documentation>
+				</xsd:annotation>
+				<xsd:simpleType>
+					<xsd:restriction base="xsd:decimal"/>
+				</xsd:simpleType>
+			</xsd:attribute>
 		</xsd:complexType>
 	</xsd:element>
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -187,7 +187,8 @@
         public static final String MESSAGE_ENTRY_TIME = "org.jboss.soa.esb.message.time.dob"; // time born
         public static final String MESSAGE_EXIT_TIME = "org.jboss.soa.esb.message.time.dod";  // time died
         public static final String MESSAGE_BYTE_SIZE = "org.jboss.soa.esb.message.byte.size"; // size
-
+        public static final String MESSAGE_TIME_PROCESSED = "org.jboss.soa.esb.message.time.processed"; // 
+        
         /** Message property name for original filename */
 
         public static final String ORIGINAL_FILE_NAME_MSG_PROP = "org.jboss.soa.esb.gateway.original.file.name";

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/ListenerTagNames.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -48,6 +48,10 @@
     public static final String SERVICE_CATEGORY_NAME_TAG    = "service-category";
 	public static final String SERVICE_NAME_TAG			    = "service-name";
 	public static final String SERVICE_DESCRIPTION_TAG      = "service-description";
+	public static final String SERVICE_ALERT_TIME_TAG 		= "service-alert-time";
+	public static final String SERVICE_ALERT_LENGTH_TAG		= "service-alert-length";
+	public static final String ACTION_ALERT_TIME_TAG		= "action-alert-time";
+	public static final String ACTION_ALERT_LENGTH_TAG		= "action-alert-length";
 	public static final String EPR_DESCRIPTION_TAG          = "epr-description";
 	public static final String REMOVE_OLD_SERVICE           = "remove-old-service";
 

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/ActionMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/ActionMapper.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/ActionMapper.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -124,6 +124,14 @@
 		actionConfigTree.setAttribute(ListenerTagNames.ACTION_ELEMENT_TAG, action.getName());
 		actionConfigTree.setAttribute(ListenerTagNames.ACTION_CLASS_TAG, action.getClass1());
 		actionConfigTree.setAttribute(ListenerTagNames.PROCESS_METHOD_TAG, action.getProcess());
+
+		if (action.getAlertLengthThreshold() != null) {
+			actionConfigTree.setAttribute(ListenerTagNames.ACTION_ALERT_LENGTH_TAG, action.getAlertLengthThreshold().toString());
+		}
+		if ( action.getAlertTimeThreshold() != null) {
+			actionConfigTree.setAttribute(ListenerTagNames.ACTION_ALERT_TIME_TAG, action.getAlertTimeThreshold().toString());			
+		}
+
 		// The "okMethods" and "exceptionMethod" attributes are supported by adding them as child <property> elements.
 
 		// Map the property elements to action attributes...

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/MapperUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/MapperUtil.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers120/MapperUtil.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -94,6 +94,12 @@
             listenerNode.setAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG, service.getCategory());
             listenerNode.setAttribute(ListenerTagNames.SERVICE_NAME_TAG, service.getName());
         }
+        if (service.getAlertTimeThreshold() != null) {
+        	listenerNode.setAttribute(ListenerTagNames.SERVICE_ALERT_TIME_TAG, service.getAlertTimeThreshold().toString());
+        } 
+        if (service.getAlertLengthThreshold() != null) {
+        	listenerNode.setAttribute(ListenerTagNames.SERVICE_ALERT_LENGTH_TAG, service.getAlertLengthThreshold().toString());
+        }
     }
 
 	/**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -428,7 +428,7 @@
 			long procTime = System.nanoTime() - start;
         	MessageCounterStatistics.getMessageCounterStatistics().update(new MessageStatusBean(procTime, message,
         			MessageStatusBean.MESSAGE_FAILED));
-
+         	
 			return false;
 		}
 	}
@@ -568,7 +568,7 @@
     		    // Need to propagate the security context regardless if security was enabled for this service or not.
 		        propagateSecurityContext(message, securityContext, authRequest);
 
-        		return (Boolean) Subject.doAsPrivileged(securityContext.getSubject(), getPrivilegedAction(message), null);
+         		return (Boolean) Subject.doAsPrivileged(securityContext.getSubject(), getPrivilegedAction(message), null);
 		    }
     		catch (final SecurityServiceException e)
     		{
@@ -668,7 +668,7 @@
 
 						final long totalProcTime = System.nanoTime() - start;
 						serviceMessageCounter.update(new ActionStatusBean(procTime, count, message,
-							ActionStatusBean.ACTION_FAILED));
+							ActionStatusBean.ACTION_FAILED, serviceMessageCounter.getObjectName().toString()));
 						MessageCounterStatistics.getMessageCounterStatistics().update(new MessageStatusBean(totalProcTime, message,
 							MessageStatusBean.MESSAGE_FAILED));
 
@@ -680,7 +680,7 @@
 					}
 					final long procTime = System.nanoTime() - actionStart;
 					serviceMessageCounter.update(new ActionStatusBean(procTime, count, message,
-						ActionStatusBean.ACTION_SENT));
+						ActionStatusBean.ACTION_SENT, serviceMessageCounter.getObjectName().toString()));
 
 					if (currentMessage == null)
 					{

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionStatusBean.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionStatusBean.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionStatusBean.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -37,6 +37,7 @@
 	private String m_status;
 	private long m_procTime;
 	private long m_bytesProcessed;
+	private long serviceTime;
 	
 	
 	public static final String ACTION_SENT = "SENT";
@@ -47,20 +48,36 @@
 	 * @param procTime processing time
 	 * @param f_procCount counter that identifies the action processor in the ConfigTree
 	 * @param f_status status string
+	 * @param objectName object name of the ServiceMessageCounter
 	 */
-	public ActionStatusBean(long procTime, int f_procCount, Message f_message, String f_status) {
+	public ActionStatusBean(long procTime, int f_procCount, Message f_message, String f_status, String objectName) {
 		m_procTime = procTime;
 		m_procCount = f_procCount;
 		m_status = f_status;
 		m_bytesProcessed = 0;
+		serviceTime = 0;
+		
+		String timeLabel = objectName + "Time";
 		try {
 			String bytes = (String) f_message.getProperties().getProperty(Environment.MESSAGE_BYTE_SIZE);
+			if (f_message.getProperties().getProperty(timeLabel) != null) {
+				Long messageServiceTime = (Long) f_message.getProperties().getProperty(objectName + "Time");
+				serviceTime = messageServiceTime.longValue() + procTime;
+				f_message.getProperties().setProperty(timeLabel, new Long(serviceTime));
+			} else {
+				serviceTime = procTime;
+				f_message.getProperties().setProperty(timeLabel, new Long(procTime));
+			}
 			m_bytesProcessed = Long.parseLong(bytes);
 		} catch (NullPointerException npe) {			
 		} catch (NumberFormatException nfe) {
 		}
 	}
-	
+
+	/**
+	 * Processed bytes getter.
+	 * @return bytes processed
+	 */
 	public long getBytesProcessed() {
 		return m_bytesProcessed;
 	}
@@ -82,10 +99,18 @@
 	}
 	
 	/**
-	 * Processing Time getter.
+	 * Action processing Time getter.
 	 * @return processing time elapsed
 	 */
 	public long getProcTime() {
 		return m_procTime;
 	}
+
+	/**
+	 * Service processing Time getter.
+	 * @return processing time elapsed
+	 */
+	public long getServiceTime() {
+		return serviceTime;
+	}
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -22,6 +22,8 @@
 
 package org.jboss.soa.esb.listeners.message;
 
+import java.lang.reflect.Method;
+import java.util.Enumeration;
 import java.util.Hashtable;
 
 import javax.management.Attribute;
@@ -30,6 +32,7 @@
 import javax.management.DynamicMBean;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
 import javax.management.InvalidAttributeValueException;
 import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanException;
@@ -51,6 +54,11 @@
  * 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. 
+ * 
  * @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
  * @since Version 4.2
  */
@@ -60,6 +68,9 @@
 	private Hashtable<String, LongHolder> actionProcessTimeHash;
 	private Hashtable<String, LongHolder> actionBytesProcessedHash;
 	private Hashtable<String, LongHolder> actionBytesFailedHash;
+
+	private Hashtable<String, Long> actionLengthThresholdHash;
+	private Hashtable<String, Long> actionTimeThresholdHash;
 	
 	private String[] actionNames;
 	private final ObjectName listObjectName ;
@@ -69,6 +80,9 @@
 	private long bytesProcessed;
 	private long bytesOverall;
 	
+	private Long alertTime = new Long("-1");
+	private Long alertLength = new Long("-1");
+	
 	public static final String RESET_COUNTER = "resetCounter";
 	private static final String MESSAGE_COUNTER = "messages successfully processed count";
 	private static final String FAILED_MESSAGE_COUNTER = "messages failed count";
@@ -81,10 +95,85 @@
 	private static final String OVERALL_BYTES_PROCESSED = "overall processedbytes";
 	private static final String OVERALL_BYTES_FAILED = "overall failed bytes";
 	
+	private static final String ALERT_TIME = "service alert time";
+	private static final String ALERT_LENGTH = "service alert length";
+	private static final String ALERT_TIME_DESC = "set service alert time";
+	private static final String ALERT_LENGTH_DESC = "set service alert desc";
+	
+	private static final String ACTION_ALERT_TIME = "action alert time";
+	private static final String ACTION_ALERT_LENGTH = "action alert length";
+	private static final String ACTION_ALERT_TIME_DESC = "set action alert time";
+	private static final String ACTION_ALERT_LENGTH_DESC = "set action alert length";
+	
+	private static final int NANOSECONDS_PER_MILLISECONDS = 1000000;
+	
 	private static final Logger logger = Logger.getLogger(ServiceMessageCounter.class);
 
+	/**
+	 * Service alert time getter
+	 * @return max message processing time for the service before an alert is fired
+	 */
+	public Long getAlertTime() {
+		return alertTime;
+	}
+
+	/**
+	 * Service alert time setter
+	 * @param alertTime max message size passing through service before an alert is fired
+	 */
+	public void setAlertTime(Long alertTime) {
+		this.alertTime = alertTime;
+	}
+
+	/**
+	 * Service alert length getter
+	 * @return max length of message passing through service before an alert is fired
+	 */
+	public Long getAlertLength() {
+		return alertLength;
+	}
+
+	/**
+	 * Service alert length setter
+	 * @param alertLength max message processing time for the service before an alert is fired
+	 */
+	public void setAlertLength(Long alertLength) {
+		this.alertLength = alertLength;
+	}
+
+	/**
+	 * Action alert time getter
+	 * @return max message processing time before an alert is fired
+	 */
+	public Long getActionAlertTime() {
+		return alertTime;
+	}
+
+	/**
+	 * Action alert time setter
+	 * @param alertLength max time (ms) the action can take before an alert is fired.
+	 */
+	public void setActionAlertTime(Long alertTime) {
+		this.alertTime = alertTime;
+	}
 	
 	/**
+	 * Action alert length getter
+	 * @return max message size passing through action before an alert is fired
+	 */
+	public Long getActionAlertLength() {
+		return alertLength;
+	}
+
+	/**
+	 * Action alert length setter
+	 * @param alertLength max message size passing through action before an alert is fired
+	 */
+	public void setActionAlertLength(Long alertLength) {
+		this.alertLength = alertLength;
+	}
+	 	
+	/**
 	 * Constructor
 	 * @param f_config config tree
 	 * @param objectName The name to use as the MBean.
@@ -95,7 +184,18 @@
 		actionProcessTimeHash = new Hashtable<String, LongHolder>();
 		actionBytesProcessedHash = new Hashtable<String, LongHolder>();
 		actionBytesFailedHash = new Hashtable<String, LongHolder>();
+
+		actionLengthThresholdHash = new Hashtable<String, Long>();
+		actionTimeThresholdHash = new Hashtable<String, Long>();
 		
+		if (f_config.getAttribute(ListenerTagNames.SERVICE_ALERT_LENGTH_TAG) != null) {
+			alertLength = new Long(f_config.getAttribute(ListenerTagNames.SERVICE_ALERT_LENGTH_TAG));
+		}
+		
+		if (f_config.getAttribute(ListenerTagNames.SERVICE_ALERT_TIME_TAG) != null) {
+			alertTime = new Long(f_config.getAttribute(ListenerTagNames.SERVICE_ALERT_TIME_TAG));
+		}
+		
 		init(f_config);
 		ObjectName listObjectName = null ;
 		try
@@ -148,6 +248,12 @@
 			actionProcessTimeHash.put(actionId + " " + PROCESSING_TIME, new LongHolder());
 			actionBytesFailedHash.put(actionId + " " + BYTES_FAILED, new LongHolder());
 			actionBytesProcessedHash.put(actionId + " " + BYTES_PROCESSED, new LongHolder());
+			if (actionConfig.getAttribute(ListenerTagNames.ACTION_ALERT_LENGTH_TAG) != null) {
+				actionLengthThresholdHash.put(actionId, new Long(actionConfig.getAttribute(ListenerTagNames.ACTION_ALERT_LENGTH_TAG)));
+			}
+			if (actionConfig.getAttribute(ListenerTagNames.ACTION_ALERT_TIME_TAG) != null) {
+				actionTimeThresholdHash.put(actionId, new Long(actionConfig.getAttribute(ListenerTagNames.ACTION_ALERT_LENGTH_TAG)));
+			}
 			actionNames[count] = actionId ;
 		}
 		serviceCount = new Integer(0);
@@ -197,8 +303,10 @@
 		
 		int count = actionCounterHash.size() + actionProcessTimeHash.size()
 			+ actionFailedCounterHash.size() + actionBytesProcessedHash.size() 
-			+ actionBytesFailedHash.size() + 4; // the extra 4 here are overall service count, failed byte size
-												  // processed byte size, and overall bytes
+			+ actionBytesFailedHash.size() + actionLengthThresholdHash.size()
+			+ actionTimeThresholdHash.size() + 6; // the extra 6 here are overall service count, failed byte size
+												// processed byte size, overall bytes, alert time, and alert
+												// length
         MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[count];
         int counter = 0;
               
@@ -251,7 +359,89 @@
 				"Property " + OVERALL_BYTES, true, false, false);
 		attrs[counter] = overallBytes;
 		counter++;		
+
+		try {
+			Method alertTimeGetter = this.getClass().getMethod("getAlertTime", new Class[0]);
+			Method alertTimeSetter = this.getClass().getMethod("setAlertTime", new Class[]{Long.class});
+			MBeanAttributeInfo alertTimeInfo = new MBeanAttributeInfo(ALERT_TIME, ALERT_TIME_DESC,
+					alertTimeGetter, alertTimeSetter);
+			attrs[counter] = alertTimeInfo;
+			counter++;
+		} catch (SecurityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NoSuchMethodException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IntrospectionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 		
+		try {
+			Method alertLengthGetter = this.getClass().getMethod("getAlertLength", new Class[0]);
+	        Method alertLengthSetter = this.getClass().getMethod("setAlertLength", new Class[]{Long.class});
+	        MBeanAttributeInfo alertLengthInfo = new MBeanAttributeInfo(ALERT_LENGTH, ALERT_LENGTH_DESC,
+	        		alertLengthGetter, alertLengthSetter);
+	        attrs[counter] = alertLengthInfo;
+	        counter++;
+		} catch (SecurityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NoSuchMethodException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IntrospectionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        		
+		try {
+			Enumeration<String> keys = actionLengthThresholdHash.keys();
+			while (keys.hasMoreElements()) {
+				String actionId = keys.nextElement();
+				Method alertLengthGetter = this.getClass().getMethod("getActionAlertLength", new Class[0]);
+				Method alertLengthSetter = this.getClass().getMethod("setActionAlertLength", new Class[]{Long.class});
+				MBeanAttributeInfo alertLengthInfo = new MBeanAttributeInfo(actionId + " " + ACTION_ALERT_LENGTH, 
+						actionId + " " + ACTION_ALERT_LENGTH_DESC,
+						alertLengthGetter, alertLengthSetter);
+				attrs[counter] = alertLengthInfo;
+				counter++;
+			}
+		} catch (SecurityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NoSuchMethodException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IntrospectionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		try {
+			Enumeration<String> keys = actionTimeThresholdHash.keys();
+			while (keys.hasMoreElements()) {
+				String actionId = keys.nextElement();
+				Method alertLengthGetter = this.getClass().getMethod("getActionAlertTime", new Class[0]);
+				Method alertLengthSetter = this.getClass().getMethod("setActionAlertTime", new Class[]{Long.class});
+				MBeanAttributeInfo alertLengthInfo = new MBeanAttributeInfo(actionId + " " + ACTION_ALERT_TIME, 
+						actionId + " " + ACTION_ALERT_TIME_DESC,
+						alertLengthGetter, alertLengthSetter);
+				attrs[counter] = alertLengthInfo;
+				counter++;
+			}
+		} catch (SecurityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NoSuchMethodException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IntrospectionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
         MBeanOperationInfo[] opers = {
         	new MBeanOperationInfo(
         			RESET_COUNTER, "Reset the counter",
@@ -294,6 +484,16 @@
     		return bytesFailed;
     	} else if (OVERALL_BYTES.equals(key)) {
     		return bytesOverall;
+    	} else if (ALERT_TIME.equals(key)) {
+    		return alertTime;
+    	} else if (ALERT_LENGTH.equals(key)) {
+    		return alertLength;
+    	} else if (key.endsWith(ACTION_ALERT_LENGTH)) {
+    		String temp = key.replace(" " + ACTION_ALERT_LENGTH, "");
+    		return actionLengthThresholdHash.get(temp);
+    	} else if (key.endsWith(ACTION_ALERT_TIME)) {
+    		String temp = key.replace (" " + ACTION_ALERT_TIME, "");
+    		return actionTimeThresholdHash.get(temp);
     	}
     	return null;
     }
@@ -357,6 +557,19 @@
 	 * @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
 	 */
 	public void setAttribute(Attribute arg0) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
+		if (ALERT_TIME.equals(arg0.getName())) {
+			alertTime = (Long) arg0.getValue();
+		} else if (ALERT_LENGTH.equals(arg0.getName())) {
+			alertLength = (Long) arg0.getValue();
+		} else if (arg0.getName().endsWith(ACTION_ALERT_LENGTH)) {
+    		String temp = arg0.getName().replace(" " + ACTION_ALERT_LENGTH, "");
+    		actionLengthThresholdHash.remove(temp);
+    		actionLengthThresholdHash.put(temp, (Long) arg0.getValue());
+    	} else if (arg0.getName().endsWith(ACTION_ALERT_TIME)) {
+    		String temp = arg0.getName().replace (" " + ACTION_ALERT_TIME, "");
+    		actionTimeThresholdHash.remove(temp);
+    		actionTimeThresholdHash.put(temp, (Long) arg0.getValue());
+    	}
 	}
 
 	/* (non-Javadoc)
@@ -418,23 +631,79 @@
 		}
 	}
 	
+	/*
+	 * Produce alerts for services if the length or time thresholds are met. 
+	 */
+	public synchronized void alertService (ActionStatusBean asb) {
+		if (!(this.getAlertTime().longValue() < 0)) {
+    		if ( (asb.getServiceTime() / NANOSECONDS_PER_MILLISECONDS) > this.getAlertTime().longValue()) {
+    			logger.warn(this.getObjectName().toString()
+    					+ " service alert time " + (asb.getServiceTime() / NANOSECONDS_PER_MILLISECONDS)
+    					+ " took longer than " + this.getAlertTime() 
+    					+ " ms");
+    		}        		
+    	}					
+		
+		if (!(this.getAlertLength().longValue() < 0)) {
+			if (asb.getBytesProcessed() > this.getAlertLength().longValue()) {
+    			logger.warn(this.getObjectName().toString()
+    					+ " service message size " + asb.getBytesProcessed()
+    					+ " was larger than " + this.getAlertLength() 
+    					+ " bytes");				
+			}
+		}
+	}
+
+	/*
+	 * Produce alerts for actions if the length or time thresholds are met. 
+	 */
+	public synchronized void alertAction (ActionStatusBean asb, String actionName) {
+		long actionTime = -1;
+		if ((actionName != null) && (actionTimeThresholdHash.containsKey(actionName))) {
+			actionTime = actionTimeThresholdHash.get(actionName);
+		}
+		if (!(actionTime < 0)) {
+    		if ( (asb.getProcTime() / NANOSECONDS_PER_MILLISECONDS) > actionTime) {
+    			logger.warn(this.getObjectName().toString() + " service, " + actionName
+    					+ " action alert time " + (asb.getProcTime() / NANOSECONDS_PER_MILLISECONDS)
+    					+ " took longer than " + actionTime 
+    					+ " ms");
+    		}        		
+    	}					
+
+		long actionLength = -1;
+		if ((actionName != null) && (actionLengthThresholdHash.containsKey(actionName))) {
+			actionLength = actionLengthThresholdHash.get(actionName);
+		}
+		if (!(actionLength < 0)) {
+			if (asb.getBytesProcessed() > actionLength) {
+    			logger.warn(this.getObjectName().toString() + " service, " + actionName
+    					+ " action message size " + asb.getBytesProcessed()
+    					+ " was larger than " + actionLength 
+    					+ " bytes");				
+			}
+		}
+	}
+	
 	/**
 	 * Update the ServiceMessageCounter
 	 * @param asb ActionStatusBean
 	 */
 	public synchronized void update(ActionStatusBean asb) {		
-		String actionName = actionNames[asb.getProcCount()]; 
-
+		String actionName = actionNames[asb.getProcCount()]; 		
+		
 		if (ActionStatusBean.ACTION_SENT.equals(asb.getStatus())) {
 			IntHolder count = actionCounterHash.get(actionName + " " + MESSAGE_COUNTER);
 			count.value++ ;
 			LongHolder time = actionProcessTimeHash.get(actionName + " " + PROCESSING_TIME);
 			time.value += asb.getProcTime();
 			LongHolder bProcessed = actionBytesProcessedHash.get(actionName + " " +  BYTES_PROCESSED);
-			bProcessed.value += asb.getBytesProcessed();
+			bProcessed.value += asb.getBytesProcessed();			
 			
+			alertAction(asb, actionName);
 			if (asb.getProcCount() == (actionNames.length-1)) {
-				bytesProcessed += asb.getBytesProcessed();				
+				bytesProcessed += asb.getBytesProcessed();
+				alertService(asb);
 			}
 		} else if (ActionStatusBean.ACTION_FAILED.equals(asb.getStatus())) {
 			IntHolder count = actionFailedCounterHash.get(actionName + " " + FAILED_MESSAGE_COUNTER);
@@ -444,6 +713,7 @@
 			LongHolder bFailed = actionBytesFailedHash.get(actionName + " " +  BYTES_FAILED);
 			bFailed.value += asb.getBytesProcessed();
 			bytesFailed += asb.getBytesProcessed();
+			alertService(asb);
 		}
 		
 		if (asb.getProcCount() == 0) {

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/Util.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/Util.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/Util.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -190,6 +190,7 @@
         out.flush();
         int size = baos.toByteArray().length;
         message.getProperties().setProperty(Environment.MESSAGE_BYTE_SIZE, "" + size);
+        message.getProperties().setProperty(Environment.MESSAGE_TIME_PROCESSED, "0");
         return baos.toString();
 	}
 	catch (final XMLStreamException xmlse)

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java	2009-10-02 16:58:13 UTC (rev 29530)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounterUnitTest.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -69,7 +69,7 @@
 	@Test
     public void getAttributesMissingKey() throws LifecycleResourceException, AttributeNotFoundException, MBeanException, ReflectionException
     {
-        counter.update(new ActionStatusBean(100l, 0, MessageFactory.getInstance().getMessage(), ActionStatusBean.ACTION_SENT));
+        counter.update(new ActionStatusBean(100l, 0, MessageFactory.getInstance().getMessage(), ActionStatusBean.ACTION_SENT, ""));
         
         try
         {

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/build.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,31 @@
+<project name="Quickstart_messagealerts" default="run" basedir=".">
+	
+	<description> 
+		${ant.project.name}
+		${line.separator}
+	</description>
+	
+	<!-- Import the base Ant build script... -->
+	<import file="../conf/base-build.xml"/>
+	
+	<target name="runtest" depends="compile" 
+		description="sends a JMS message to queue/quickstart_messagealerts_Request_gw">
+		<echo>Runs Test JMS Sender</echo>
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.messagealerts.test.SendJMSMessage" failonerror="true">
+			<arg value="Message Alerts"/>
+			<classpath refid="exec-classpath"/>
+		</java>
+	</target>  
+	
+	<target name="sendesb" depends="compile"
+		description="Will send an esb Message">
+		<echo>Runs Test ESB Message Sender</echo>
+		<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.messagealerts.test.SendEsbMessage" failonerror="true">
+			<arg value="FirstServiceESB"/> <!--  service category -->
+			<arg value="SimpleListener"/>  <!--  service name -->
+			<arg value="Message Alerts - Straight to ESB listener - no Gateway"/> <!--  Message text -->
+			<classpath refid="exec-classpath"/>
+		</java>
+	</target>
+	
+</project>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/deployment.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/deployment.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,4 @@
+<jbossesb-deployment>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagealerts_Request_esb</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagealerts_Request_gw</depends>
+</jbossesb-deployment>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbm-queue-service.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagealerts_Request_esb"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+	<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagealerts_Request_gw"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+	<depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+</server>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbmq-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbmq-queue-service.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagealerts_Request_esb">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_messagealerts_Request_gw">
+    <depends optional-attribute-name="DestinationManager">
+      jboss.mq:service=DestinationManager
+    </depends>
+  </mbean>
+</server>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jboss-esb.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,58 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
+
+    <providers>
+          <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+              <jms-bus busid="quickstartGwChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_messagealerts_Request_gw"
+                   />
+              </jms-bus>
+              <jms-bus busid="quickstartEsbChannel">
+                  <jms-message-filter
+                      dest-type="QUEUE"
+                      dest-name="queue/quickstart_messagealerts_Request_esb"
+                  />
+              </jms-bus>
+
+          </jms-provider>
+      </providers>
+      
+      <services>
+        <service 
+        	category="FirstServiceESB" 
+        	name="SimpleListener" 
+        	description="Hello World"
+        	alertTimeThreshold="420"
+        	alertLengthThreshold="10"
+        	>
+            <listeners>
+                <jms-listener name="JMS-Gateway"
+                    busidref="quickstartGwChannel"
+                    is-gateway="true"
+                />
+                <jms-listener name="helloWorld"
+                              busidref="quickstartEsbChannel"
+                />
+            </listeners>
+            <actions mep="OneWay">
+                   <action name="action1" 
+                   	class="org.jboss.soa.esb.samples.quickstart.messagealerts.MyJMSListenerAction" 
+                   	process="displayMessage"
+                   	/>      
+                    <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
+                      <property name="printfull" value="false"/>
+                    </action>
+                    <action name="action3" class="org.jboss.soa.esb.samples.quickstart.messagealerts.DelayAction"
+                    	process="delayMessage"
+                        alertTimeThreshold="30"
+                        alertLengthThreshold="50">
+                    </action>
+                    <!-- The next action is for Continuous Integration testing -->
+                    <action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+            </actions>
+        </service>
+      </services>
+     
+</jbossesb>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbossesb-properties.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jbossesb-properties.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2006, JBoss Inc., and others contributors as indicated 
+  by the @authors tag. All rights reserved. 
+  See the copyright.txt in the distribution for a
+  full listing of individual contributors. 
+  This copyrighted material is made available to anyone wishing to use,
+  modify, copy, or redistribute it subject to the terms and conditions
+  of the GNU Lesser General Public License, v. 2.1.
+  This program is distributed in the hope that it will be useful, but WITHOUT A 
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+  PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public License,
+  v.2.1 along with this distribution; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+  MA  02110-1301, USA.
+  
+  (C) 2005-2006,
+  @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+  These options are described in the JBossESB manual.
+  Defaults are provided here for convenience only.
+ 
+  Please read through this file prior to using the system, and consider
+  updating the specified entries.
+-->
+<esb
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+    <properties name="core">
+		<property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+		<property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+		<property name="org.jboss.soa.esb.persistence.connection.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+        <property name="jboss.esb.invm.scope.default" value="NONE"/>
+    </properties>
+    <properties name="registry">      
+    	<property name="org.jboss.soa.esb.registry.queryManagerURI"     		
+    		value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>    		
+    	<property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"     		
+    		value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+    	<property name="org.jboss.soa.esb.registry.implementationClass" 
+    		value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.factoryClass" 
+    		value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.user" 
+    		value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.registry.password" 
+    	  value="password"/>
+    	<!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+    	<property name="org.jboss.soa.esb.scout.proxy.transportClass" 
+    		value="org.apache.ws.scout.transport.RMITransport"/>
+    </properties>
+    <properties name="transports" depends="core">
+    	<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+    	<property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+    </properties>
+    <properties name="connection">
+    	<property name="min-pool-size" value="5"/>
+    	<property name="max-pool-size" value="10"/>
+    	<property name="blocking-timeout-millis" value="5000"/>
+    	<property name="abandoned-connection-timeout" value="10000"/>
+    	<property name="abandoned-connection-time-interval" value="30000"/>
+    </properties>
+    <properties name="dbstore">
+		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/"/>
+		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
+		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
+		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
+		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
+		<!--table managed by pool to test for valid connections - created by pool automatically -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
+		<!-- # of milliseconds to timeout waiting for a connection from pool -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
+                <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+    </properties>
+    <properties name="messagerouting">
+    	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+    </properties>
+</esb>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jndi.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/jndi.properties	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/juddi.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/juddi.properties	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any 
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct 
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+ 
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+  

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/listener.log
===================================================================

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/log4j.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/log4j.xml	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A size based file rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="./listener.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+     </layout>	    
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="quickstart">
+      <priority value="DEBUG"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/readme.txt	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/readme.txt	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,22 @@
+Overview:
+=========
+  The purpose of the messagealert quickstart sample is to show how the ESB is
+  can set off warnings when a message exceeds size or processing time limits. 
+  The ESB can monitor either services or actions for these message attributes.
+
+  The threshold can be set on the jboss-esb.xml and can be changed later 
+  within the jmx-console.      
+  
+
+Running this quickstart:
+========================
+  Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+  and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run:
+===========================
+  1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+  2. Open another command terminal window in this folder ("Window2"), type
+     'ant runtest'.
+  3. Switch back to Application Server console to see the output from the ESB
+  4. In this folder ("Window1"), type 'ant undeploy'.

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/DelayAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/DelayAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/DelayAction.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.messagealerts;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class DelayAction extends AbstractActionLifecycle
+{
+    
+  protected ConfigTree	_config;
+	  
+  public DelayAction(ConfigTree config) { _config = config; } 
+
+  public Message delayMessage(Message message) throws Exception {
+		  Thread.sleep(3000);	
+		  return message; 
+        		
+  }
+}

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/MyJMSListenerAction.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/MyJMSListenerAction.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.messagealerts;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class MyJMSListenerAction extends AbstractActionLifecycle
+{
+    
+  protected ConfigTree	_config;
+	  
+  public MyJMSListenerAction(ConfigTree config) { _config = config; } 
+
+  
+  public Message displayMessage(Message message) throws Exception{
+		
+		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");		  		  
+		  System.out.println("Body: " + message.getBody().get()) ;
+		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
+		  return message; 
+        		
+	}
+    
+	
+}

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendEsbMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendEsbMessage.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.samples.quickstart.messagealerts.test;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.client.ServiceInvoker;
+
+/**
+ * Standalone class with to send ESB messages to a 'known' [category,name].
+ * <p/> arg0 - service category
+ * <br/>arg1 - service name
+ * <br/>arg2 - Text of message to send
+ * 
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * @since Version 4.0
+ *
+ */
+public class SendEsbMessage 
+{
+    public static void main(String args[]) throws Exception
+    {
+//      Setting the ConnectionFactory such that it will use scout
+        System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
+        
+    	if (args.length < 3)
+    	{
+    		System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
+    	}
+    	
+    	Message esbMessage = MessageFactory.getInstance().getMessage();
+
+    	esbMessage.getBody().add(args[2]);
+    	
+        new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
+    	
+    }
+    
+}

Added: labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendJMSMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/messagealerts/src/org/jboss/soa/esb/samples/quickstart/messagealerts/test/SendJMSMessage.java	2009-10-02 17:25:18 UTC (rev 29531)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.messagealerts.test;
+
+import java.util.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class SendJMSMessage {
+    QueueConnection conn;
+    QueueSession session;
+    Queue que;
+    
+    
+    public void setupConnection() throws JMSException, NamingException
+    {
+        Properties properties1 = new Properties();
+		properties1.put(Context.INITIAL_CONTEXT_FACTORY,
+				"org.jnp.interfaces.NamingContextFactory");
+		properties1.put(Context.URL_PKG_PREFIXES,
+				"org.jboss.naming:org.jnp.interfaces");
+		properties1.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
+		InitialContext iniCtx = new InitialContext(properties1);
+
+    	Object tmp = iniCtx.lookup("ConnectionFactory");
+    	QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+    	conn = qcf.createQueueConnection();
+    	que = (Queue) iniCtx.lookup("queue/quickstart_messagealerts_Request_gw");
+    	session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    	conn.start();
+    	System.out.println("Connection Started");
+    }
+    
+    public void stop() throws JMSException 
+    { 
+        conn.stop();
+        session.close();
+        conn.close();
+    }
+    
+    public void sendAMessage(String msg) throws JMSException {
+    	
+        QueueSender send = session.createSender(que);        
+        ObjectMessage tm = session.createObjectMessage(msg);
+        
+        send.send(tm);        
+        send.close();
+    }
+       
+    
+    public static void main(String args[]) throws Exception
+    {        	    	
+    	SendJMSMessage sm = new SendJMSMessage();
+    	sm.setupConnection();
+    	sm.sendAMessage(args[0]); 
+    	sm.stop();
+    	
+    }
+    
+}



More information about the jboss-svn-commits mailing list