Apache JMeter

## org.apache.jmeter.protocol.jms.client
Class OnMessageSubscriber

    java.lang.Object
      org.apache.jmeter.protocol.jms.client.OnMessageSubscriber

public class OnMessageSubscriber
extends Object

OnMessageSubscriber is designed to create the connection, session and subscriber. The sampler is responsible for implementing javax.jms.MessageListener interface and onMessage(Message msg) method. The implementation provides a close() method to clean up the client at the end of a test. This is important to make sure there aren't any zombie threads or odd memory leaks.

Constructor Summary
`OnMessageSubscriber()`
`OnMessageSubscriber(boolean useProps, String jndi, String url, String connfactory, String topic, boolean useAuth, String user, String pwd)` Constructor takes the necessary JNDI related parameters to create a connection and begin receiving messages.

Method Summary
`void` `close()` close will close all the objects and set them to null.
`void` `initConnection(Context ctx, String connfactory, String topic)` Initialize the connection, session and subscriber
`Context` `initJNDI(boolean useProps, String jndi, String url, boolean useAuth, String user, String pwd)` initialize the JNDI intial context
`void` `resume()` resume will call Connection.start() to begin receiving inbound messages.
`void` `setMessageListener(javax.jms.MessageListener listener)` The sample uses this method to set itself as the listener.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OnMessageSubscriber

    public OnMessageSubscriber()

### OnMessageSubscriber

    public OnMessageSubscriber(boolean useProps,
                               String jndi,
                               String url,
                               String connfactory,
                               String topic,
                               boolean useAuth,
                               String user,
                               String pwd)

  Constructor takes the necessary JNDI related parameters to create a connection and begin receiving messages.

Parameters:
  `useProps` -
  `jndi` -
  `url` -
  `connfactory` -
  `topic` -
  `useAuth` -
  `user` -
  `pwd` -

Method Detail

### initJNDI

    public Context initJNDI(boolean useProps,
                            String jndi,
                            String url,
                            boolean useAuth,
                            String user,
                            String pwd)

  initialize the JNDI intial context

  Parameters:
    `useProps` -
    `jndi` -
    `url` -
    `useAuth` -
    `user` -
    `pwd` -
  Returns:
    the context or null

### initConnection

    public void initConnection(Context ctx,
                               String connfactory,
                               String topic)

  Initialize the connection, session and subscriber

  Parameters:
    `ctx` -
    `connfactory` -
    `topic` -

### resume

    public void resume()

  resume will call Connection.start() to begin receiving inbound messages.

### close

    public void close()

  close will close all the objects and set them to null.

### setMessageListener

    public void setMessageListener(javax.jms.MessageListener listener)

  The sample uses this method to set itself as the listener. That means the sampler need to implement MessageListener interface.

  Parameters:
    `listener` -

Apache JMeter

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