public class BenchmarkRunner extends Object
AmqpDirectEndpoint or Camel-based endpoint
(depending on the brokerUrl given) with a BenchmarkConsumer
to measure the throughput of a broker.
brokerUrl beginning with:
tcp: creates a Camel-based endpoint using JSON object marshaling/unmarshalingamqp: creates an AmqpDirectEndpoint without object marshaling| Modifier and Type | Field and Description |
|---|---|
protected String |
brokerUrl |
protected static String |
DEFAULT_ENDPOINT |
protected String |
endpointReceive |
protected String |
endpointSend |
protected static String |
LOG_SEPERATOR |
protected int |
logAfterNumMessages |
protected int |
numMessages |
protected boolean |
runConsumer |
protected boolean |
runProducer |
| Constructor and Description |
|---|
BenchmarkRunner(String brokerUrl,
String endpointSend,
String endpointReceive,
int numMessages,
boolean runProducer,
boolean runConsumer) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
formatMillis(long milliseconds)
Formats a millisecond value for rounded seconds if sufficiently large
|
protected BenchmarkConsumer |
getBenchmarkConsumer() |
protected Object |
getBenchmarkMessage(int i) |
protected String |
getDefaultReceiveEndpoint(String endpointSend) |
protected org.gytheio.messaging.MessageProducer |
initializeAmqpDirectEndpoint(String brokerUrl,
String endpointSend,
String endpointReceive,
org.gytheio.messaging.MessageConsumer messageConsumer)
Initializes a Qpid-based AMQP endpoint with no object marshaling with given
brokerUrl, endpoint, and messageConsumer.
|
protected org.gytheio.messaging.MessageProducer |
initializeCamelEndpoint(String brokerUrl,
String endpointSend,
String endpointReceive,
org.gytheio.messaging.MessageConsumer messageConsumer)
Initializes a Camel context and configures routes and object marshaling with the given
brokerUrl, enpoint, and messageConsumer.
|
protected void |
logStart(int numMessages,
String brokerUrl,
String endpointSend,
String endpointReceive,
boolean runProducer,
boolean runConsumer)
Logs the start of the benchmark to sys out
|
protected void |
logStatistics(org.gytheio.messaging.MessageProducer endpoint,
BenchmarkConsumer consumer,
Object message,
int numMessages,
long sendTime,
long receiveTime)
Logs the results of the benchmark to sys out
|
void |
runBenchmark() |
protected static final String DEFAULT_ENDPOINT
protected static final String LOG_SEPERATOR
protected int logAfterNumMessages
protected String brokerUrl
protected String endpointSend
protected String endpointReceive
protected int numMessages
protected boolean runProducer
protected boolean runConsumer
protected Object getBenchmarkMessage(int i)
protected BenchmarkConsumer getBenchmarkConsumer()
protected org.gytheio.messaging.MessageProducer initializeCamelEndpoint(String brokerUrl, String endpointSend, String endpointReceive, org.gytheio.messaging.MessageConsumer messageConsumer) throws Exception
brokerUrl - endpoint - messageConsumer - Exceptionprotected org.gytheio.messaging.MessageProducer initializeAmqpDirectEndpoint(String brokerUrl, String endpointSend, String endpointReceive, org.gytheio.messaging.MessageConsumer messageConsumer)
brokerUrl - endpoint - messageConsumer - protected void logStart(int numMessages,
String brokerUrl,
String endpointSend,
String endpointReceive,
boolean runProducer,
boolean runConsumer)
numMessages - brokerUrl - endpoint - protected void logStatistics(org.gytheio.messaging.MessageProducer endpoint,
BenchmarkConsumer consumer,
Object message,
int numMessages,
long sendTime,
long receiveTime)
endpoint - numMessages - sendTime - receiveTime - protected String formatMillis(long milliseconds)
milliseconds - Copyright © 2017 Alfresco Software. All rights reserved.