org.apache.qpid.ping
Class PingClient

java.lang.Object
  extended by org.apache.qpid.requestreply.PingPongProducer
      extended by org.apache.qpid.ping.PingClient
All Implemented Interfaces:
Runnable, ExceptionListener

public class PingClient
extends PingPongProducer

PingClient is a PingPongProducer that does not need a PingPongBouncer to send replies to its pings. It simply listens to its own ping destinations, rather than seperate reply queues. It is an all in one ping client, that produces and consumes its own pings.

The constructor increments a count of the number of ping clients created. It is assumed that where many are created they will all be run in parallel and be active in sending and consuming pings at the same time. If the unique destinations flag is not set and a pub/sub ping cycle is being run, this means that they will all hear pings sent by each other. The expected number of pings received will therefore be multiplied up by the number of active ping clients. The getConsumersPerDestination() method is used to supply this multiplier under these conditions.

CRC Card
Responsibilities Collaborations
Create a ping producer that listens to its own pings PingPongProducer
Count the number of ping producers and produce multiplier for scaling up messages expected over topic pings.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.requestreply.PingPongProducer
PingPongProducer.ChainedMessageListener, PingPongProducer.PerCorrelationId
 
Field Summary
 
Fields inherited from class org.apache.qpid.requestreply.PingPongProducer
_ackMode, _brokerDetails, _chainedMessageListener, _connection, _consAckMode, _consTransacted, _consumer, _consumerConnection, _consumerSession, _destinationName, _factoryName, _failAfterCommit, _failAfterSend, _failBeforeCommit, _failBeforeSend, _failOnce, _fileProperties, _isDurable, _isPubSub, _isUnique, _maxPendingSize, _messageSize, _noOfConsumers, _noOfDestinations, _overrideClientId, _password, _persistent, _pingDestinations, _producer, _producerSession, _publish, _queueJVMSequenceID, _queueNamePostfix, _queueSharedID, _rate, _rateLimiter, _replyDestination, _selector, _transacted, _txBatchSize, _username, _verbose, _virtualpath, ACK_MODE_DEFAULT, ACK_MODE_PROPNAME, BROKER_DEFAULT, BROKER_PROPNAME, CONSUME_ONLY_DEFAULT, CONSUME_ONLY_PROPNAME, CONSUMER_ACK_MODE_DEFAULT, CONSUMER_ACK_MODE_PROPNAME, CONSUMER_TRANSACTED_DEFAULT, CONSUMER_TRANSACTED_PROPNAME, defaults, DELAY_BEFORE_CONSUME, DELAY_BEFORE_CONSUME_PROPNAME, DESTINATION_COUNT_DEFAULT, DESTINATION_COUNT_PROPNAME, DURABLE_DESTS_DEFAULT, DURABLE_DESTS_PROPNAME, EXCLUSIVE_DEFAULT, FACTORY_NAME_DEAFULT, FACTORY_NAME_PROPNAME, FAIL_AFTER_COMMIT_DEFAULT, FAIL_AFTER_COMMIT_PROPNAME, FAIL_AFTER_SEND_DEFAULT, FAIL_AFTER_SEND_PROPNAME, FAIL_BEFORE_COMMIT_DEFAULT, FAIL_BEFORE_COMMIT_PROPNAME, FAIL_BEFORE_SEND_DEFAULT, FAIL_BEFORE_SEND_PROPNAME, FAIL_ONCE_DEFAULT, FAIL_ONCE_PROPNAME, FILE_PROPERTIES_DEAFULT, FILE_PROPERTIES_PROPNAME, MAX_PENDING_DEFAULT, MAX_PENDING_PROPNAME, MESSAGE_SIZE_DEAFULT, MESSAGE_SIZE_PROPNAME, MESSAGE_TIMESTAMP_PROPNAME, NO_LOCAL_DEFAULT, NUM_CONSUMERS_DEFAULT, NUM_CONSUMERS_PROPNAME, OVERRIDE_CLIENT_ID_DEAFULT, OVERRIDE_CLIENT_ID_PROPNAME, PASSWORD_DEFAULT, PASSWORD_PROPNAME, PERSISTENT_MODE_DEFAULT, PERSISTENT_MODE_PROPNAME, PING_QUEUE_NAME_DEFAULT, PING_QUEUE_NAME_PROPNAME, PREFETCH_DEFAULT, PREFILL_DEFAULT, PREFILL_PROPNAME, PUBSUB_DEFAULT, PUBSUB_PROPNAME, QUEUE_NAME_POSTFIX_DEFAULT, QUEUE_NAME_POSTFIX_PROPNAME, RATE_DEFAULT, RATE_PROPNAME, SELECTOR_DEFAULT, SELECTOR_PROPNAME, SEND_ONLY_DEFAULT, SEND_ONLY_PROPNAME, TIMEOUT_DEFAULT, TIMEOUT_PROPNAME, timestampFormatter, TRANSACTED_DEFAULT, TRANSACTED_PROPNAME, TX_BATCH_SIZE_DEFAULT, TX_BATCH_SIZE_PROPNAME, UNIQUE_DESTS_DEFAULT, UNIQUE_DESTS_PROPNAME, USERNAME_DEFAULT, USERNAME_PROPNAME, VERBOSE_DEFAULT, VERBOSE_PROPNAME, VIRTUAL_HOST_DEFAULT, VIRTUAL_HOST_PROPNAME
 
Constructor Summary
PingClient(Properties overrides)
          Creates a ping producer with the specified parameters, of which there are many.
 
Method Summary
 int getClientCount()
           
 int getConsumersPerDestination()
          Supplies the multiplier for the number of ping clients that will hear each ping when doing pub/sub pinging.
 List<Destination> getReplyDestinations()
          Returns the ping destinations themselves as the reply destinations for this pinger to listen to.
 
Methods inherited from class org.apache.qpid.requestreply.PingPongProducer
close, commitTx, createConnection, createPingDestinations, createProducer, createReplyConsumers, establishConnection, getExpectedNumPings, getShutdownHook, getTestMessage, getTimestamp, main, onException, onMessageWithConsumerNo, pause, pingAndWaitForReply, pingAndWaitForReply, pingLoop, pingNoWaitForReply, removeChainedMessageListener, run, sendMessage, setChainedMessageListener, setTimestamp, setupCorrelationID, start, stop, waitForUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PingClient

public PingClient(Properties overrides)
           throws Exception
Creates a ping producer with the specified parameters, of which there are many. See the class level comments for PingPongProducer for details. This constructor creates a connection to the broker and creates producer and consumer sessions on it, to send and recieve its pings and replies on.

Parameters:
overrides - Properties containing any desired overrides to the defaults.
Throws:
Exception - Any exceptions are allowed to fall through.
Method Detail

getReplyDestinations

public List<Destination> getReplyDestinations()
Returns the ping destinations themselves as the reply destinations for this pinger to listen to. This has the effect of making this pinger listen to its own pings.

Overrides:
getReplyDestinations in class PingPongProducer
Returns:
The ping destinations.

getConsumersPerDestination

public int getConsumersPerDestination()
Supplies the multiplier for the number of ping clients that will hear each ping when doing pub/sub pinging.

Overrides:
getConsumersPerDestination in class PingPongProducer
Returns:
The scaling up of the number of expected pub/sub pings.

getClientCount

public int getClientCount()


Licensed to the Apache Software Foundation