Class SubscriberSampler

All Implemented Interfaces:
Serializable, Cloneable, ConfigMergabilityIndicator, Searchable, Interruptible, Sampler, org.apache.jmeter.testelement.TestElement, TestStateListener, ThreadListener

public class SubscriberSampler extends BaseJMSSampler implements Interruptible, ThreadListener, TestStateListener
This class implements the JMS Subscriber sampler. It supports both receive and onMessage strategies via the ReceiveSubscriber class.
See Also:
  • Constructor Details

    • SubscriberSampler

      public SubscriberSampler()
  • Method Details

    • 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
    • threadStarted

      public void threadStarted()
      Initialise the thread-local variables.
      Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet. See org.apache.jmeter.threads.JMeterThread#threadStarted()
      Specified by:
      threadStarted in interface ThreadListener
    • threadStarted

      public void threadStarted(boolean wts)
    • threadFinished

      public void threadFinished()
      Close subscriber.
      Called for each thread after all samples have been processed. See org.apache.jmeter.threads.JMeterThread#threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)
      Specified by:
      threadFinished in interface ThreadListener
    • threadFinished

      public void threadFinished(boolean wts)
    • interrupt

      public boolean interrupt()
      Handle an interrupt of the test.
      Specified by:
      interrupt in interface Interruptible
      Returns:
      true if there was an operation to interrupt.
    • setClientChoice

      public void setClientChoice(String choice)
      Set the client choice. There are two options: ReceiveSusbscriber and OnMessageSubscriber.
      Parameters:
      choice - the client to use. One of RECEIVE_RSC or ON_MESSAGE_RSC
    • getClientChoice

      public String getClientChoice()
      Return the client choice.
      Returns:
      the client choice, either RECEIVE_RSC or ON_MESSAGE_RSC
    • getTimeout

      public String getTimeout()
    • getTimeoutAsLong

      public long getTimeoutAsLong()
    • setTimeout

      public void setTimeout(String timeout)
    • getDurableSubscriptionId

      public String getDurableSubscriptionId()
    • getClientId

      public String getClientId()
      Returns:
      JMS Client ID
    • getJmsSelector

      public String getJmsSelector()
      Returns:
      JMS selector
    • setDurableSubscriptionId

      public void setDurableSubscriptionId(String durableSubscriptionId)
    • setClientID

      public void setClientID(String clientId)
      Parameters:
      clientId - JMS CLient id
    • setJmsSelector

      public void setJmsSelector(String jmsSelector)
      Parameters:
      jmsSelector - JMS Selector
    • getSeparator

      public String getSeparator()
      Returns:
      Separator for sampler results
    • setSeparator

      public void setSeparator(String text)
      Separator for sampler results
      Parameters:
      text - separator to use for sampler results
    • isStopBetweenSamples

      public boolean isStopBetweenSamples()
    • setStopBetweenSamples

      public void setStopBetweenSamples(boolean selected)
    • setPauseBetweenErrors

      public void setPauseBetweenErrors(String pause)
    • getPauseBetweenErrors

      public String getPauseBetweenErrors()
    • getPauseBetweenErrorsAsLong

      public long getPauseBetweenErrorsAsLong()
    • testEnded

      public void testEnded()

      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 TestStateListener
      See Also:
    • testEnded

      public void testEnded(String host)

      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 TestStateListener
      Parameters:
      host - name of host
      See Also:
    • testStarted

      public void testStarted()

      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 TestStateListener
      See Also:
    • testStarted

      public void testStarted(String host)

      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 TestStateListener
      Parameters:
      host - name of host
      See Also: