public class Bootstrap 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 static String |
DEFAULT_QUEUE |
protected static String |
LOG_SEPERATOR |
protected static String |
USAGE_MESSAGE |
| Constructor and Description |
|---|
Bootstrap() |
| Modifier and Type | Method and Description |
|---|---|
protected static String |
formatMillis(long milliseconds)
Formats a millisecond value for rounded seconds if sufficientaly large
|
protected static org.gytheio.messaging.MessageProducer |
initializeAmqpDirectEndpoint(String brokerUrl,
String queue,
org.gytheio.messaging.MessageConsumer messageConsumer)
Initializes a Qpid-based AMQP endpoint with no object marshaling with given
brokerUrl, queue, and messageConsumer.
|
protected static org.gytheio.messaging.MessageProducer |
initializeCamelEndpoint(String brokerUrl,
String queue,
org.gytheio.messaging.MessageConsumer messageConsumer)
Initializes a Camel context and configures routes and object marshaling with the given
brokerUrl, queue, and messageConsumer.
|
protected static void |
logStart(int numMessages,
String brokerUrl,
String queue)
Logs the start of the benchmark to sys out
|
protected static void |
logStatistics(org.gytheio.messaging.MessageProducer endpoint,
int numMessages,
long sendTime,
long receiveTime)
Logs the results of the benchmark to sys out
|
static void |
main(String[] args) |
protected static void |
runBenchmark(String brokerUrl,
String queue,
int numMessages) |
protected static final String DEFAULT_QUEUE
protected static final String USAGE_MESSAGE
protected static final String LOG_SEPERATOR
public static void main(String[] args)
protected static void runBenchmark(String brokerUrl, String queue, int numMessages) throws Exception
Exceptionprotected static org.gytheio.messaging.MessageProducer initializeCamelEndpoint(String brokerUrl, String queue, org.gytheio.messaging.MessageConsumer messageConsumer) throws Exception
brokerUrl - queue - messageConsumer - Exceptionprotected static org.gytheio.messaging.MessageProducer initializeAmqpDirectEndpoint(String brokerUrl, String queue, org.gytheio.messaging.MessageConsumer messageConsumer)
brokerUrl - queue - messageConsumer - protected static void logStart(int numMessages,
String brokerUrl,
String queue)
numMessages - brokerUrl - queue - protected static void logStatistics(org.gytheio.messaging.MessageProducer endpoint,
int numMessages,
long sendTime,
long receiveTime)
endpoint - numMessages - sendTime - receiveTime - protected static String formatMillis(long milliseconds)
milliseconds - Copyright © 2014 Alfresco Software. All rights reserved.