org.apache.jmeter.protocol.jms.sampler

## Class SubscriberSampler

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.samplers.AbstractSampler
    - - org.apache.jmeter.protocol.jms.sampler.BaseJMSSampler
      - - org.apache.jmeter.protocol.jms.sampler.SubscriberSampler

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ConfigMergabilityIndicator, Searchable, Interruptible, Sampler, 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:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SubscriberSampler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getClientChoice()` Return the client choice.
    `java.lang.String` | `getClientId()`
    `java.lang.String` | `getDurableSubscriptionId()`
    `java.lang.String` | `getJmsSelector()`
    `java.lang.String` | `getPauseBetweenErrors()`
    `long` | `getPauseBetweenErrorsAsLong()`
    `java.lang.String` | `getSeparator()`
    `java.lang.String` | `getTimeout()`
    `long` | `getTimeoutAsLong()`
    `boolean` | `interrupt()` Handle an interrupt of the test.
    `boolean` | `isStopBetweenSamples()`
    `SampleResult` | `sample()` sample method will check which client it should use and call the appropriate client specific sample method.
    `void` | `setClientChoice(java.lang.String choice)` Set the client choice.
    `void` | `setClientID(java.lang.String clientId)`
    `void` | `setDurableSubscriptionId(java.lang.String durableSubscriptionId)`
    `void` | `setJmsSelector(java.lang.String jmsSelector)`
    `void` | `setPauseBetweenErrors(java.lang.String pause)`
    `void` | `setSeparator(java.lang.String text)` Separator for sampler results
    `void` | `setStopBetweenSamples(boolean selected)`
    `void` | `setTimeout(java.lang.String timeout)`
    `void` | `testEnded()` Called once for all threads after the end of a test.
    `void` | `testEnded(java.lang.String host)` Called once for all threads after the end of a test.
    `void` | `testStarted()` Called just before the start of the test from the main engine thread.
    `void` | `testStarted(java.lang.String host)` Called just before the start of the test from the main engine thread.
    `void` | `threadFinished()` Close subscriber.
    `void` | `threadFinished(boolean wts)`
    `void` | `threadStarted()` Initialise the thread-local variables.
    `void` | `threadStarted(boolean wts)`

    - ### Methods inherited from class org.apache.jmeter.protocol.jms.sampler.BaseJMSSampler

      `configureIsReconnectErrorCode, getConnectionFactory, getDestination, getIsReconnectErrorCode, getIterationCount, getIterations, getJNDIInitialContextFactory, getMessageHeaders, getPassword, getProviderUrl, getReadResponse, getReadResponseAsBoolean, getReconnectionErrorCodes, getUseJNDIProperties, getUseJNDIPropertiesAsBoolean, getUsername, isDestinationStatic, isUseAuth, sample, setConnectionFactory, setDestination, setDestinationStatic, setIterations, setJNDIIntialContextFactory, setPassword, setProviderUrl, setReadResponse, setReconnectionErrorCodes, setUseAuth, setUseJNDIProperties, setUsername`

    - ### Methods inherited from class org.apache.jmeter.samplers.AbstractSampler

      `applies`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, 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, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Constructor Detail

    - #### SubscriberSampler

          public SubscriberSampler()

  - ### Method Detail

    - #### 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(java.lang.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 java.lang.String getClientChoice()

      Return the client choice.
      Returns:
        the client choice, either `RECEIVE_RSC` or `ON_MESSAGE_RSC`

    - #### getTimeout

          public java.lang.String getTimeout()

    - #### getTimeoutAsLong

          public long getTimeoutAsLong()

    - #### setTimeout

          public void setTimeout(java.lang.String timeout)

    - #### getDurableSubscriptionId

          public java.lang.String getDurableSubscriptionId()

    - #### getClientId

          public java.lang.String getClientId()

      Returns:
        JMS Client ID

    - #### getJmsSelector

          public java.lang.String getJmsSelector()

      Returns:
        JMS selector

    - #### setDurableSubscriptionId

          public void setDurableSubscriptionId(java.lang.String durableSubscriptionId)

    - #### setClientID

          public void setClientID(java.lang.String clientId)

      Parameters:
        `clientId` - JMS CLient id

    - #### setJmsSelector

          public void setJmsSelector(java.lang.String jmsSelector)

      Parameters:
        `jmsSelector` - JMS Selector

    - #### getSeparator

          public java.lang.String getSeparator()

      Returns:
        Separator for sampler results

    - #### setSeparator

          public void setSeparator(java.lang.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(java.lang.String pause)

    - #### getPauseBetweenErrors

          public java.lang.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:
        `StandardJMeterEngine.stopTest()`

    - #### testEnded

          public void testEnded(java.lang.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:
        `StandardJMeterEngine.stopTest()`

    - #### 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:
        `StandardJMeterEngine.run()`

    - #### testStarted

          public void testStarted(java.lang.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:
        `StandardJMeterEngine.run()`

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