Package org.acemq.workloads.scenario
Class ScenarioRunner
java.lang.Object
org.acemq.workloads.scenario.ScenarioRunner
Starts scenarios.
ScenarioReport report = ScenarioRunner.run(scenario, "amqp://localhost");
// or, for something that needs to watch and to stop:
ScenarioHandle handle = ScenarioRunner.start(scenario, "amqp://localhost", sample ->
send(sample));
handle.stop();
ScenarioReport report = handle.report().join();
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScenarioReportRuns it and waits.static ScenarioReportRuns it against a broker that needs TLS, and waits.static ScenarioReportrun(Scenario scenario, String brokerUrl, org.acemq.amqp.security.Security security, ScenarioListener listener, AtomicBoolean stopRequested) Runs it on this thread, reporting as it goes and stopping when asked.static ScenarioHandlestart(Scenario scenario, String brokerUrl, org.acemq.amqp.security.Security security, ScenarioListener listener) Starts it against a broker that needs TLS.static ScenarioHandlestart(Scenario scenario, String brokerUrl, ScenarioListener listener) Starts it on a thread of its own and reports as it goes.
-
Method Details
-
run
Runs it and waits.- Parameters:
scenario- what to runbrokerUrl- an AMQP URL- Returns:
- what happened
-
run
public static ScenarioReport run(Scenario scenario, String brokerUrl, org.acemq.amqp.security.Security security) Runs it against a broker that needs TLS, and waits.- Parameters:
scenario- what to runbrokerUrl- an AMQPS URLsecurity- the TLS policy: a private CA, a client certificate, or both- Returns:
- what happened
-
run
public static ScenarioReport run(Scenario scenario, String brokerUrl, org.acemq.amqp.security.Security security, ScenarioListener listener, AtomicBoolean stopRequested) Runs it on this thread, reporting as it goes and stopping when asked.Everything
start(org.acemq.workloads.scenario.Scenario, java.lang.String, org.acemq.workloads.scenario.ScenarioListener)offers without the thread: a command line that prints progress and ends the run on an interrupt wants exactly this, and spawning a thread only to wait on its future is a worse way to get it.- Parameters:
scenario- what to runbrokerUrl- an AMQP URLsecurity- the TLS policy, or null for what the URL implieslistener- told about each readingstopRequested- set it to end the measured window early; the report still describes what was measured up to that point- Returns:
- what happened
-
start
Starts it on a thread of its own and reports as it goes.- Parameters:
scenario- what to runbrokerUrl- an AMQP URLlistener- told about each reading- Returns:
- a handle on the run
-
start
public static ScenarioHandle start(Scenario scenario, String brokerUrl, org.acemq.amqp.security.Security security, ScenarioListener listener) Starts it against a broker that needs TLS.- Parameters:
scenario- what to runbrokerUrl- an AMQPS URLsecurity- the TLS policy, or null for what the URL implieslistener- told about each reading- Returns:
- a handle on the run
-