Class ScenarioRunner

java.lang.Object
org.acemq.workloads.scenario.ScenarioRunner

public final class ScenarioRunner extends Object
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 Details

    • run

      public static ScenarioReport run(Scenario scenario, String brokerUrl)
      Runs it and waits.
      Parameters:
      scenario - what to run
      brokerUrl - 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 run
      brokerUrl - an AMQPS URL
      security - 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 run
      brokerUrl - an AMQP URL
      security - the TLS policy, or null for what the URL implies
      listener - told about each reading
      stopRequested - set it to end the measured window early; the report still describes what was measured up to that point
      Returns:
      what happened
    • start

      public static ScenarioHandle start(Scenario scenario, String brokerUrl, ScenarioListener listener)
      Starts it on a thread of its own and reports as it goes.
      Parameters:
      scenario - what to run
      brokerUrl - an AMQP URL
      listener - 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 run
      brokerUrl - an AMQPS URL
      security - the TLS policy, or null for what the URL implies
      listener - told about each reading
      Returns:
      a handle on the run