org.apache.jmeter.protocol.jms.sampler

## Class PublisherSampler

- 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.PublisherSampler

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ConfigMergabilityIndicator, Searchable, Sampler, TestElement, TestStateListener

      public class PublisherSampler
      extends BaseJMSSampler
      implements TestStateListener

  This class implements the JMS Publisher sampler.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_ENCODING` Encoding value to sent parsed data but read with default system encoding
    `static java.util.Set<java.lang.String>` | `NO_ENCODING` Constant for system default encodings
    `static java.lang.String` | `RAW_DATA` Encoding value to sent data as is (no variabilisation)

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

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PublisherSampler()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static com.github.benmanes.caffeine.cache.Cache<java.lang.Object,java.lang.Object>` | `buildCache(java.lang.String configChoice)`
    `java.lang.String` | `getConfigChoice()` return the source of the message Converts from old JMX files which used the local language string
    `java.lang.String` | `getExpiration()`
    `java.lang.String` | `getFileEncoding()` Gets file encoding to use.
    `java.lang.String` | `getInputFile()`
    `JMSProperties` | `getJMSProperties()`
    `java.lang.String` | `getMessageChoice()`
    `java.lang.String` | `getPriority()`
    `java.lang.String` | `getRandomPath()`
    `static java.lang.String[]` | `getSupportedEncodings()` Init available encoding using constants, then JVM standard ones
    `java.lang.String` | `getTextMessage()`
    `boolean` | `getUseNonPersistentDelivery()`
    `SampleResult` | `sample()` The implementation will publish n messages within a for loop.
    `void` | `setConfigChoice(java.lang.String choice)` set the source of the message
    `void` | `setExpiration(java.lang.String s)`
    `void` | `setFileEncoding(java.lang.String fileEncoding)` Sets file encoding to use.
    `void` | `setInputFile(java.lang.String file)` set the input file for the publisher
    `void` | `setJMSProperties(JMSProperties jmsProperties)`
    `void` | `setMessageChoice(java.lang.String choice)` set the type of the message
    `void` | `setPriority(java.lang.String s)`
    `void` | `setRandomPath(java.lang.String path)` set the random path for the messages
    `void` | `setTextMessage(java.lang.String message)` set the text for the message
    `void` | `setUseNonPersistentDelivery(boolean value)`
    `void` | `testEnded()` endTest cleans up the client
    `void` | `testEnded(java.lang.String host)` the implementation calls testEnded() without any parameters.
    `void` | `testStarted()` Called just before the start of the test from the main engine thread.
    `void` | `testStarted(java.lang.String test)` the implementation calls testStarted() without any parameters.

    - ### 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`

- - ### Field Detail

    - #### RAW_DATA

          public static final java.lang.String RAW_DATA

      Encoding value to sent data as is (no variabilisation)
      See Also:
        Constant Field Values

    - #### DEFAULT_ENCODING

          public static final java.lang.String DEFAULT_ENCODING

      Encoding value to sent parsed data but read with default system encoding
      See Also:
        Constant Field Values

    - #### NO_ENCODING

          public static final java.util.Set<java.lang.String> NO_ENCODING

      Constant for system default encodings

  - ### Constructor Detail

    - #### PublisherSampler

          public PublisherSampler()

  - ### Method Detail

    - #### getSupportedEncodings

          public static java.lang.String[] getSupportedEncodings()

      Init available encoding using constants, then JVM standard ones
      Returns:
        Array of String containing supported encodings

    - #### testStarted

          public void testStarted(java.lang.String test)

      the implementation calls testStarted() without any parameters.
      Specified by:
        `testStarted` in interface `TestStateListener`
      Parameters:
        `test` - name of host
      See Also:
        `StandardJMeterEngine.run()`

    - #### testEnded

          public void testEnded(java.lang.String host)

      the implementation calls testEnded() without any parameters.
      Specified by:
        `testEnded` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### testEnded

          public void testEnded()

      endTest cleans up the client
      Specified by:
        `testEnded` in interface `TestStateListener`
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### testStarted

          public void testStarted()

      Description copied from interface: `TestStateListener`

      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()`

    - #### sample

          public SampleResult sample()

      The implementation will publish n messages within a for loop. Once n messages are published, it sets the attributes of SampleResult.
      Specified by:
        `sample` in class `BaseJMSSampler`
      Returns:
        the populated sample result

    - #### buildCache

          protected static com.github.benmanes.caffeine.cache.Cache<java.lang.Object,java.lang.Object> buildCache(java.lang.String configChoice)

    - #### setConfigChoice

          public void setConfigChoice(java.lang.String choice)

      set the source of the message
      Parameters:
        `choice` - source of the messages. One of `JMSPublisherGui.USE_FILE_RSC`, `JMSPublisherGui.USE_RANDOM_RSC` or JMSPublisherGui#USE_TEXT_RSC

    - #### getConfigChoice

          public java.lang.String getConfigChoice()

      return the source of the message Converts from old JMX files which used the local language string
      Returns:
        source of the messages

    - #### setMessageChoice

          public void setMessageChoice(java.lang.String choice)

      set the type of the message
      Parameters:
        `choice` - type of the message (Text, Object, Map)

    - #### getMessageChoice

          public java.lang.String getMessageChoice()

      Returns:
        the type of the message (Text, Object, Map)

    - #### setInputFile

          public void setInputFile(java.lang.String file)

      set the input file for the publisher
      Parameters:
        `file` - input file for the publisher

    - #### getInputFile

          public java.lang.String getInputFile()

      Returns:
        the path of the input file

    - #### setRandomPath

          public void setRandomPath(java.lang.String path)

      set the random path for the messages
      Parameters:
        `path` - random path for the messages

    - #### getRandomPath

          public java.lang.String getRandomPath()

      Returns:
        the random path for messages

    - #### setTextMessage

          public void setTextMessage(java.lang.String message)

      set the text for the message
      Parameters:
        `message` - text for the message

    - #### getTextMessage

          public java.lang.String getTextMessage()

      Returns:
        the text for the message

    - #### getExpiration

          public java.lang.String getExpiration()

    - #### getPriority

          public java.lang.String getPriority()

    - #### setPriority

          public void setPriority(java.lang.String s)

    - #### setExpiration

          public void setExpiration(java.lang.String s)

    - #### setUseNonPersistentDelivery

          public void setUseNonPersistentDelivery(boolean value)

      Parameters:
        `value` - boolean use NON_PERSISTENT

    - #### getUseNonPersistentDelivery

          public boolean getUseNonPersistentDelivery()

      Returns:
        true if NON_PERSISTENT delivery must be used

    - #### getJMSProperties

          public JMSProperties getJMSProperties()

      Returns:
        `JMSProperties` JMS Properties

    - #### setJMSProperties

          public void setJMSProperties(JMSProperties jmsProperties)

      Parameters:
        `jmsProperties` - JMS Properties

    - #### getFileEncoding

          public java.lang.String getFileEncoding()

      Gets file encoding to use. If `RAW_DATA`, content isn't parsed.
      Returns:
        File encoding.
      See Also:
        `RAW_DATA`, `DEFAULT_ENCODING`, `getSupportedEncodings()`

    - #### setFileEncoding

          public void setFileEncoding(java.lang.String fileEncoding)

      Sets file encoding to use. If `RAW_DATA`, content isn't parsed.
      Parameters:
        `fileEncoding` - File encoding.
      See Also:
        `RAW_DATA`, `DEFAULT_ENCODING`, `getSupportedEncodings()`

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