Apache JMeter

org.apache.jmeter.protocol.jms.sampler
Class SubscriberSampler

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.samplers.AbstractSampler
          extended byorg.apache.jmeter.protocol.jms.sampler.BaseJMSSampler
              extended byorg.apache.jmeter.protocol.jms.sampler.SubscriberSampler
All Implemented Interfaces:
Cloneable, javax.jms.MessageListener, Sampler, Serializable, TestElement, TestListener

public class SubscriberSampler
extends BaseJMSSampler
implements TestListener, javax.jms.MessageListener

This class implements the JMS Subcriber sampler

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
SubscriberSampler()
           
 
Method Summary
 String getClientChoice()
          Return the client choice.
 void onMessage(javax.jms.Message message)
          The sampler implements MessageListener directly and sets itself as the listener with the TopicSubscriber.
 SampleResult sample()
          sample method will check which client it should use and call the appropriate client specific sample method.
 void setClientChoice(String choice)
          Set the client choice.
 void testEnded()
          testEnded is called by Jmeter's engine.
 void testEnded(String test)
           Called once for all threads after the end of a test.
 void testIterationStart(LoopIterationEvent event)
          Each time through a Thread Group's test script, an iteration event is fired for each thread.
 void testStarted()
           Called just before the start of the test from the main engine thread.
 void testStarted(String test)
           Called just before the start of the test from the main engine thread.
 
Methods inherited from class org.apache.jmeter.protocol.jms.sampler.BaseJMSSampler
getConnectionFactory, getIterationCount, getIterations, getJNDIInitialContextFactory, getPassword, getProviderUrl, getReadResponse, getReadResponseAsBoolean, getTopic, getUseJNDIProperties, getUseJNDIPropertiesAsBoolean, getUsername, isUseAuth, sample, setConnectionFactory, setIterations, setJNDIIntialContextFactory, setPassword, setProviderUrl, setReadResponse, setTopic, setUseAuth, setUseJNDIProperties, setUsername
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.testelement.TestElement
addTestElement, canRemove, clear, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
 

Constructor Detail

SubscriberSampler

public SubscriberSampler()
Method Detail

testEnded

public void testEnded(String test)
Description copied from interface: TestListener

Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testEnded in interface TestListener
See Also:
StandardJMeterEngine.stopTest()

testStarted

public void testStarted(String test)
Description copied from interface: TestListener

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testStarted in interface TestListener
See Also:
StandardJMeterEngine.run()

testEnded

public void testEnded()
testEnded is called by Jmeter's engine. Clears the client pool.

Specified by:
testEnded in interface TestListener
See Also:
StandardJMeterEngine.stopTest()

testStarted

public void testStarted()
Description copied from interface: TestListener

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
testStarted in interface TestListener
See Also:
StandardJMeterEngine.run()

testIterationStart

public void testIterationStart(LoopIterationEvent event)
Description copied from interface: TestListener
Each time through a Thread Group's test script, an iteration event is fired for each thread. This will be after the test elements have been cloned, so in general the instance will not be the same as the ones the start/end methods call.

Specified by:
testIterationStart in interface TestListener
Parameters:
event -

sample

public SampleResult sample()
sample method will check which client it should use and call the appropriate client specific sample method.

Specified by:
sample in class BaseJMSSampler
Returns:
the appropriate sample result

onMessage

public void onMessage(javax.jms.Message message)
The sampler implements MessageListener directly and sets itself as the listener with the TopicSubscriber.

Specified by:
onMessage in interface javax.jms.MessageListener

setClientChoice

public void setClientChoice(String choice)
Set the client choice. There are two options: ReceiveSusbscriber and OnMessageSubscriber.


getClientChoice

public String getClientChoice()
Return the client choice.

Returns:
the client choice, either RECEIVE_RSC or ON_MESSAGE_RSC

Apache JMeter

Copyright © 1998-2009 Apache Software Foundation. All Rights Reserved.