org.apache.jmeter.protocol.jms.client

Class 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(MessageListener listener)
The sample uses this method to set itself as the listener.

Constructor Details

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 Details

close

public void close()
close will close all the objects and set them to null.

initConnection

public void initConnection(Context ctx,
                           String connfactory,
                           String topic)
Initialize the connection, session and subscriber
Parameters:
ctx -
connfactory -
topic -

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

resume

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

setMessageListener

public void setMessageListener(MessageListener listener)
The sample uses this method to set itself as the listener. That means the sampler need to implement MessageListener interface.
Parameters:
listener -

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