You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/11/05 14:06:13 UTC
cvs commit: jakarta-commons-sandbox/jelly project.xml
jstrachan 2002/11/05 05:06:13
Modified: jelly/src/java/org/apache/commons/jelly/tags/jms
JMSTagLibrary.java SubscribeTag.java
jelly project.xml
Added: jelly/src/java/org/apache/commons/jelly/tags/jms
ConsumerTag.java StopwatchTag.java
Log:
Added a ConsumerTag interface to allow JMS message consumers to be nested to implement different behaviours such as transactions, message adornment and transformation and simple stuff like timing.
Also added a simple <stopwatch> tag which can be used to time the throughput of messages for a subscription
Revision Changes Path
1.5 +1 -0 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jms/JMSTagLibrary.java
Index: JMSTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jms/JMSTagLibrary.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JMSTagLibrary.java 30 Oct 2002 19:16:25 -0000 1.4
+++ JMSTagLibrary.java 5 Nov 2002 13:06:13 -0000 1.5
@@ -80,6 +80,7 @@
registerTag("property", PropertyTag.class);
registerTag("receive", ReceiveTag.class);
registerTag("send", SendTag.class);
+ registerTag("stopwatch", StopwatchTag.class);
registerTag("subscribe", SubscribeTag.class);
registerTag("textMessage", TextMessageTag.class);
}
1.3 +1 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jms/SubscribeTag.java
Index: SubscribeTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jms/SubscribeTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SubscribeTag.java 30 Oct 2002 19:16:25 -0000 1.2
+++ SubscribeTag.java 5 Nov 2002 13:06:13 -0000 1.3
@@ -79,7 +79,7 @@
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision$
*/
-public class SubscribeTag extends MessageOperationTag {
+public class SubscribeTag extends MessageOperationTag implements ConsumerTag {
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog(SubscribeTag.class);
1.1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jms/ConsumerTag.java
Index: ConsumerTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/taglibs/beanshell/src/java/org/apache/commons/jelly/tags/beanshell/BeanShellExpressionFactory.java,v 1.1 2002/05/21 07:58:55 jstrachan Exp $
* $Revision: 1.1 $
* $Date: 2002/05/21 07:58:55 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* $Id: BeanShellExpressionFactory.java,v 1.1 2002/05/21 07:58:55 jstrachan Exp $
*/
package org.apache.commons.jelly.tags.jms;
import javax.jms.MessageListener;
/**
* Represents an interface for a Tag which consumes JMS messages.
* By default this is the <subscribe> tag but other tags could
* implement this interface to enabled things like Message pipelining,
* transactional message consumer tags, stopwatch wrappers etc.
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision: 1.1 $
*/
public interface ConsumerTag {
/**
* Sets the JMS messageListener used to consume JMS messages
*/
public void setMessageListener(MessageListener messageListener);
}
1.1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jms/StopwatchTag.java
Index: StopwatchTag.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/taglibs/beanshell/src/java/org/apache/commons/jelly/tags/beanshell/BeanShellExpressionFactory.java,v 1.1 2002/05/21 07:58:55 jstrachan Exp $
* $Revision: 1.1 $
* $Date: 2002/05/21 07:58:55 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* $Id: BeanShellExpressionFactory.java,v 1.1 2002/05/21 07:58:55 jstrachan Exp $
*/
package org.apache.commons.jelly.tags.jms;
import javax.jms.MessageListener;
import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.messenger.tool.StopWatchMessageListener;
/**
* This tag can be used to measure the amount of time it takes to process JMS messages.
* This tag can be wrapped around any custom JMS tag which consumes JMS messages.
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @version $Revision: 1.1 $
*/
public class StopwatchTag extends MessageOperationTag implements ConsumerTag {
/** the underlying MessageListener */
private MessageListener messageListener;
/** The Log to which logging calls will be made. */
private Log log = LogFactory.getLog( StopwatchTag.class );
/** the message group size */
private int groupSize = 1000;
public StopwatchTag() {
}
// Tag interface
//-------------------------------------------------------------------------
public void doTag(XMLOutput output) throws Exception {
// evaluate body as it may contain child tags to register a MessageListener
invokeBody(output);
MessageListener listener = getMessageListener();
ConsumerTag tag = (ConsumerTag) findAncestorWithClass(ConsumerTag.class);
if (tag == null) {
throw new JellyException("This tag must be nested within a ConsumerTag like the subscribe tag");
}
// clear the listener for the next tag invocation, if caching is employed
setMessageListener(null);
StopWatchMessageListener stopWatch = new StopWatchMessageListener(listener);
stopWatch.setGroupSize(groupSize);
stopWatch.setLog(log);
// perform the consumption
tag.setMessageListener(stopWatch);
}
// Properties
//-------------------------------------------------------------------------
/**
* @return the number of messages in the group before the performance statistics are logged
*/
public int getGroupSize() {
return groupSize;
}
/**
* Sets the number of messages in the group before the performance statistics are logged
*/
public void setGroupSize(int groupSize) {
this.groupSize = groupSize;
}
/**
* @return the logger to which statistic messages will be sent
*/
public Log getLog() {
return log;
}
/**
* Sets the logger to which statistic messages will be sent
*/
public void setLog(Log log) {
this.log = log;
}
/**
* @return the MessageListener which this listener delegates to
*/
public MessageListener getMessageListener() {
return messageListener;
}
/**
* Sets the JMS messageListener used to consume JMS messages on the given destination
*/
public void setMessageListener(MessageListener messageListener) {
this.messageListener = messageListener;
}
}
1.85 +1 -1 jakarta-commons-sandbox/jelly/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/project.xml,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- project.xml 30 Oct 2002 11:54:11 -0000 1.84
+++ project.xml 5 Nov 2002 13:06:13 -0000 1.85
@@ -354,7 +354,7 @@
<!-- jms taglib -->
<dependency>
<id>commons-messenger</id>
- <version>1.0-dev-3</version>
+ <version>1.0-dev-8</version>
</dependency>
<dependency>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>