Apache JMeter
2.1.1

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

Author:
pete To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments
See Also:
Serialized Form

Field Summary
static String CLIENT_CHOICE
           
 
Fields inherited from class org.apache.jmeter.protocol.jms.sampler.BaseJMSSampler
CONN_FACTORY, CREDENTIALS, ITERATIONS, JNDI_INITIAL_CONTEXT_FAC, not_req, PRINCIPAL, PROVIDER_URL, READ_RESPONSE, required, TOPIC, USE_AUTH, USE_PROPERTIES_FILE
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
SubscriberSampler()
           
 
Method Summary
 int count(int count)
          increment the count and return the new value.
 String getClientChoice()
          Return the client choice.
 OnMessageSubscriber initListenerClient()
          Create the OnMessageSubscriber client and set the sampler as the message listener.
 void initReceiveClient()
          Create the ReceiveSubscriber client for the sampler.
 void onMessage(javax.jms.Message message)
          The sampler implements MessageListener directly and sets itself as the listener with the TopicSubscriber.
 void resetCount()
          resetCount will set the counter to zero and set the length of the StringBuffer to zero.
 SampleResult sample()
          sample method will check which client it should use and call the appropriate client specific sample method.
 SampleResult sample(Entry e)
          Obtains statistics about the given Entry, and packages the information into a SampleResult.
 SampleResult sampleWithListener()
          sample will block until messages are received
 SampleResult sampleWithReceive()
          Sample method uses the ReceiveSubscriber client instead of onMessage approach.
 void setClientChoice(String choice)
          Set the client choice.
 void testEnded()
          testEnded is called by Jmeter's engine. the implementation will reset the count, set RUN to false and clear the StringBuffer.
 void testEnded(String test)
           
 void testIterationStart(LoopIterationEvent event)
          Each time through a Thread Group's test script, an iteration event is fired.
 void testStarted()
          Called just before the start of the test Note that not all the test variables will have been set up at this point.
 void testStarted(String test)
           
 
Methods inherited from class org.apache.jmeter.protocol.jms.sampler.BaseJMSSampler
getConnectionFactory, getIterationCount, getIterations, getJNDIInitialContextFactory, getPassword, getProviderUrl, getReadResponse, getReadResponseAsBoolean, getTopic, getUseAuth, getUseJNDIProperties, getUseJNDIPropertiesAsBoolean, getUsername, 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, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.testelement.TestElement
addTestElement, canRemove, clear, clone, getProperty, getPropertyAsBoolean, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse
 

Field Detail

CLIENT_CHOICE

public static String CLIENT_CHOICE
Constructor Detail

SubscriberSampler

public SubscriberSampler()
Method Detail

testEnded

public void testEnded(String test)
Specified by:
testEnded in interface TestListener
Specified by:
testEnded in class BaseJMSSampler

testStarted

public void testStarted(String test)
Specified by:
testStarted in interface TestListener
Specified by:
testStarted in class BaseJMSSampler

testEnded

public void testEnded()
testEnded is called by Jmeter's engine. the implementation will reset the count, set RUN to false and clear the StringBuffer.

Specified by:
testEnded in interface TestListener
Specified by:
testEnded in class BaseJMSSampler

testStarted

public void testStarted()
Description copied from interface: TestListener
Called just before the start of the test Note that not all the test variables will have been set up at this point.

Specified by:
testStarted in interface TestListener
Specified by:
testStarted in class BaseJMSSampler

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.

Specified by:
testIterationStart in interface TestListener
Specified by:
testIterationStart in class BaseJMSSampler

initListenerClient

public OnMessageSubscriber initListenerClient()
Create the OnMessageSubscriber client and set the sampler as the message listener.

Returns:

initReceiveClient

public void initReceiveClient()
Create the ReceiveSubscriber client for the sampler.


sample

public SampleResult sample(Entry e)
Description copied from interface: Sampler
Obtains statistics about the given Entry, and packages the information into a SampleResult.

Specified by:
sample in interface Sampler
Overrides:
sample in class BaseJMSSampler

sample

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

Returns:

sampleWithListener

public SampleResult sampleWithListener()
sample will block until messages are received

Returns:

sampleWithReceive

public SampleResult sampleWithReceive()
Sample method uses the ReceiveSubscriber client instead of onMessage approach.

Returns:

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

count

public int count(int count)
increment the count and return the new value.

Parameters:
count -
Returns:

resetCount

public void resetCount()
resetCount will set the counter to zero and set the length of the StringBuffer to zero.


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:

Apache JMeter
2.1.1

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