org.apache.jmeter.protocol.jms.client

Class ReceiveSubscriber

Implemented Interfaces:
Runnable

public class ReceiveSubscriber
extends Object
implements Runnable

Receives messages in a separate thread until told to stop. Run loop permanently receives messages; the sampler calls reset() when it has taken enough messages.

Constructor Summary

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

Method Summary

void
close()
close() will stop the connection first.
int
count(int increment)
Increment the count and return the new value
byte[]
getByteResult()
Get the message(s) as an array of byte[]
String
getMessage()
Get the message as a string
void
reset()
Reset the receiver ready for receiving any further messages
void
resume()
Resume will call Connection.start() and begin receiving messages from the JMS provider.
void
run()
run calls listen to begin listening for inbound messages from the provider.
void
setLoop(int loop)
Set the number of iterations for each call to sample()
void
start()
start will create a new thread and pass this class. once the thread is created, it calls Thread.start().

Constructor Details

ReceiveSubscriber

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

Method Details

close

public void close()
close() will stop the connection first. Then it closes the subscriber, session and connection.

count

public int count(int increment)
Increment the count and return the new value
Parameters:
increment -

getByteResult

public byte[] getByteResult()
Get the message(s) as an array of byte[]

getMessage

public String getMessage()
Get the message as a string

reset

public void reset()
Reset the receiver ready for receiving any further messages

resume

public void resume()
Resume will call Connection.start() and begin receiving messages from the JMS provider.

run

public void run()
run calls listen to begin listening for inbound messages from the provider. Updates the count field so the caller can check how many messages have been receieved.

setLoop

public void setLoop(int loop)
Set the number of iterations for each call to sample()
Parameters:
loop -

start

public void start()
start will create a new thread and pass this class. once the thread is created, it calls Thread.start().

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