|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.requestreply.PingPongBouncer
public class PingPongBouncer
PingPongBouncer is a message listener the bounces back messages to their reply to destination. This is used to return
ping messages generated by PingPongProducer
but could be used for other purposes
too.
Responsibilities | Collaborations |
---|---|
Bounce back messages to their reply to destination. | |
Provide command line invocation to start the bounce back on a configurable broker url. |
Nested Class Summary | |
---|---|
static class |
PingPongBouncer.FailoverNotifier
A connection listener that logs out any failover complete events. |
Field Summary | |
---|---|
protected boolean |
_failAfterCommit
This flag is used to indicate that the user should be prompted to a kill a broker, in order to test failover, immediate after committing a transaction. |
protected boolean |
_failBeforeCommit
This flag is used to indicate that the user should be prompted to kill a broker, in order to test failover, immediately before committing a transaction. |
protected static SimpleDateFormat |
timestampFormatter
A convenient formatter to use when time stamping output. |
Constructor Summary | |
---|---|
PingPongBouncer(String brokerDetails,
String username,
String password,
String virtualpath,
String destinationName,
boolean persistent,
boolean transacted,
String selector,
boolean verbose,
boolean pubsub)
Creates a PingPongBouncer on the specified producer and consumer sessions. |
Method Summary | |
---|---|
protected void |
commitTx(org.apache.qpid.jms.Session session)
Convenience method to commit the transaction on the specified controlSession. |
protected void |
doFailover()
Prompts the user to terminate the broker, in order to test failover functionality. |
protected void |
doFailover(String broker)
Prompts the user to terminate the named broker, in order to test failover functionality. |
org.apache.qpid.client.AMQConnection |
getConnection()
Gets the underlying connection that this ping client is running on. |
boolean |
isPubSub()
Checks whether this client is a p2p or pub/sub ping client. |
static void |
main(String[] args)
Starts a stand alone ping-pong client running in verbose mode. |
void |
onMessage(Message message)
This is a callback method that is notified of all messages for which this has been registered as a message listener on a message consumer. |
void |
setConnection(org.apache.qpid.client.AMQConnection connection)
Sets the connection that this ping client is using. |
void |
setPubSub(boolean pubsub)
Sets or clears the pub/sub flag to indiciate whether this client is pinging a queue or a topic. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final SimpleDateFormat timestampFormatter
protected boolean _failBeforeCommit
protected boolean _failAfterCommit
Constructor Detail |
---|
public PingPongBouncer(String brokerDetails, String username, String password, String virtualpath, String destinationName, boolean persistent, boolean transacted, String selector, boolean verbose, boolean pubsub) throws Exception
brokerDetails
- The addresses of the brokers to connect to.username
- The broker username.password
- The broker password.virtualpath
- The virtual host name within the broker.destinationName
- The name of the queue to receive pings on
(or root of the queue name where many queues are generated).persistent
- A flag to indicate that persistent message should be used.transacted
- A flag to indicate that pings should be sent within transactions.selector
- A message selector to filter received pings with.verbose
- A flag to indicate that message timings should be sent to the console.
Exception
- All underlying exceptions allowed to fall through. This is only test code...Method Detail |
---|
public static void main(String[] args) throws Exception
args
-
Exception
public void onMessage(Message message)
onMessage
in interface MessageListener
message
- The message that triggered this callback.public org.apache.qpid.client.AMQConnection getConnection()
public void setConnection(org.apache.qpid.client.AMQConnection connection)
connection
- The ping connection.public void setPubSub(boolean pubsub)
pubsub
- true if this client is pinging a topic, false if it is pinging a queue.public boolean isPubSub()
protected void commitTx(org.apache.qpid.jms.Session session) throws JMSException
_failBeforeCommit
flag is set, this will prompt the user to kill the broker before the
commit is applied. If the _failAfterCommit
flag is set, this will prompt the user to kill the broker
after the commit is applied.
JMSException
- If the commit fails and then the rollback fails.protected void doFailover(String broker)
broker
- The name of the broker to terminate.protected void doFailover()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |