public class RabbitMqCommand extends Object implements Callable<org.zeroturnaround.exec.StartedProcess>
sbin folder of the RabbitMQ installation.
Example usage:
RabbitMqCommand command = new RabbitMqCommand(config, "rabbitmq-server", "-detached");
StartedProcess process = command.call();
// ...
To read the output as it happens, use the writeOutputTo(OutputStream) method.
To be notified of the process ending without blocking for the result of the finished process, use
listenToEvents(ProcessListener) method.
RabbitMqCtl,
RabbitMqServer| Modifier and Type | Class and Description |
|---|---|
static class |
RabbitMqCommand.ProcessExecutorFactory |
| Constructor and Description |
|---|
RabbitMqCommand(EmbeddedRabbitMqConfig config,
String command,
String... arguments)
Constructs a new instance this class to execute arbitrary RabbitMQ commands with arbitrary arguments.
|
| Modifier and Type | Method and Description |
|---|---|
org.zeroturnaround.exec.StartedProcess |
call() |
RabbitMqCommand |
listenToEvents(org.zeroturnaround.exec.listener.ProcessListener listener)
Registers a unique listener to be notified of process events, such as start and finish.
|
RabbitMqCommand |
logStandardErrorOutputAs(org.zeroturnaround.exec.stream.slf4j.Level level)
Defines which logging level to use for the processes' standard error output.
|
RabbitMqCommand |
logStandardOutputAs(org.zeroturnaround.exec.stream.slf4j.Level level)
Defines which logging level to use for the process' standard output.
|
RabbitMqCommand |
logWith(org.slf4j.Logger logger)
Defines which SLF4J logger to use log the process output as it would have been dumped to STDOUT and STDERR.
|
RabbitMqCommand |
storeOutput(boolean storeOutput)
Used to define if the output of the process should be stored for retrieval after the ProcessResult future is
completed.
|
RabbitMqCommand |
writeErrorOutputTo(OutputStream outputStream)
Error output from the process will be written here as it happens.
|
RabbitMqCommand |
writeOutputTo(OutputStream outputStream)
Output from the process will be written here as it happens.
|
public RabbitMqCommand(EmbeddedRabbitMqConfig config, String command, String... arguments)
logWith(Logger) to use another Logger
INFO
WARN
ProcessResult
from the resulting call() execution. To disable storing the output see storeOutput(boolean)
To obtain the output as a stream as it's being produced,
see writeOutputTo(OutputStream) and writeErrorOutputTo(OutputStream).
listenToEvents(ProcessListener) to define a listener.
config - the configuration information used to launch the process with the correct context.command - command name, without any path or extension. For example, for a command like
"rabbitmq-plugins.bat list", use "rabbitmq-plugins" as valuearguments - list of arguments to pass to the executable. For example, for a command like
"./rabbitmq-plugins enable foo", utilize ["enable", "foo"] as valuepublic RabbitMqCommand writeOutputTo(OutputStream outputStream)
writeErrorOutputTo(OutputStream)public RabbitMqCommand writeErrorOutputTo(OutputStream outputStream)
writeOutputTo(OutputStream)public RabbitMqCommand logWith(org.slf4j.Logger logger)
public RabbitMqCommand listenToEvents(org.zeroturnaround.exec.listener.ProcessListener listener)
public RabbitMqCommand storeOutput(boolean storeOutput)
truepublic RabbitMqCommand logStandardOutputAs(org.zeroturnaround.exec.stream.slf4j.Level level)
Default is INFO
public RabbitMqCommand logStandardErrorOutputAs(org.zeroturnaround.exec.stream.slf4j.Level level)
Default is WARN
public org.zeroturnaround.exec.StartedProcess call()
throws RabbitMqCommandException
call in interface Callable<org.zeroturnaround.exec.StartedProcess>RabbitMqCommandExceptionCopyright © 2016–2017. All rights reserved.