public static class EmbeddedRabbitMqConfig.Builder extends Object
EmbeddedRabbitMqConfig instance.
Example use:
EmbeddedRabbitMqConfig config = new EmbeddedRabbitMqConfig.Builder()
.version(...);
.downloadFrom(...)
...
.build();
EmbeddedRabbitMqConfig| Modifier and Type | Field and Description |
|---|---|
static String |
DOWNLOAD_FOLDER |
| Constructor and Description |
|---|
EmbeddedRabbitMqConfig.Builder()
Creates a new instance of the Configuration Builder.
|
| Modifier and Type | Method and Description |
|---|---|
EmbeddedRabbitMqConfig |
build()
Builds an immutable instance of
EmbeddedRabbitMqConfig using smart defaults. |
EmbeddedRabbitMqConfig.Builder |
defaultRabbitMqCtlTimeoutInMillis(long defaultRabbitMqCtlTimeoutInMillis) |
EmbeddedRabbitMqConfig.Builder |
deleteDownloadedFileOnErrors(boolean deleteCachedFile)
If there's an issue downloading or extracting the artifact, automatically delete from downloaded file to prevent
future re-use.
|
EmbeddedRabbitMqConfig.Builder |
downloadConnectionTimeoutInMillis(long downloadConnectionTimeoutInMillis) |
EmbeddedRabbitMqConfig.Builder |
downloadFolder(File downloadFolder)
Use this method to define a location where the compressed artifact will be downloaded to.
|
EmbeddedRabbitMqConfig.Builder |
downloadFrom(ArtifactRepository repository)
Defines where the artifact should be downloaded from and characteristics of the downloaded artifact.
|
EmbeddedRabbitMqConfig.Builder |
downloadFrom(URL downloadSource,
String appFolderName) |
EmbeddedRabbitMqConfig.Builder |
downloadProxy(Proxy downloadProxy) |
EmbeddedRabbitMqConfig.Builder |
downloadProxy(String hostname,
int port) |
EmbeddedRabbitMqConfig.Builder |
downloadReadTimeoutInMillis(long downloadReadTimeoutInMillis) |
EmbeddedRabbitMqConfig.Builder |
downloadTarget(File downloadTarget)
Use this method to specify a file which should be used to store the downloaded artifact.
|
EmbeddedRabbitMqConfig.Builder |
envVar(RabbitMqEnvVar key,
String value)
Defines an environment variable value to use for the execution of all RabbitMQ commands.
|
EmbeddedRabbitMqConfig.Builder |
envVar(String key,
String value)
Defines an environment variable value to use for the execution of all RabbitMQ commands.
|
EmbeddedRabbitMqConfig.Builder |
envVars(Map<String,String> map)
A helper method to define several variables at once.
|
EmbeddedRabbitMqConfig.Builder |
erlangCheckTimeoutInMillis(long erlangCheckTimeoutInMillis) |
EmbeddedRabbitMqConfig.Builder |
extractionFolder(File extractionFolder)
Define a folder where the artifact should be extracted to.
|
EmbeddedRabbitMqConfig.Builder |
port(int port)
Defines the port that this RabbitMQ broker node will run on.
|
EmbeddedRabbitMqConfig.Builder |
processExecutorFactory(RabbitMqCommand.ProcessExecutorFactory factory) |
EmbeddedRabbitMqConfig.Builder |
rabbitMqServerInitializationTimeoutInMillis(long rabbitMqServerInitializationTimeoutInMillis) |
EmbeddedRabbitMqConfig.Builder |
randomPort()
Defines the port that this RabbitMQ broker node will run on.
|
EmbeddedRabbitMqConfig.Builder |
useCachedDownload(boolean cacheDownload)
If the artifact is already present in the filesystem, setting this as {code true} will prevent re-downloading it.
|
EmbeddedRabbitMqConfig.Builder |
version(Version version)
Use a specific version of RabbitMQ.
|
public static final String DOWNLOAD_FOLDER
public EmbeddedRabbitMqConfig.Builder()
This class uses the Builder pattern where you can chain several methods and invoke build() at the end.
@Beta public EmbeddedRabbitMqConfig.Builder downloadReadTimeoutInMillis(long downloadReadTimeoutInMillis)
@Beta public EmbeddedRabbitMqConfig.Builder downloadConnectionTimeoutInMillis(long downloadConnectionTimeoutInMillis)
@Beta public EmbeddedRabbitMqConfig.Builder defaultRabbitMqCtlTimeoutInMillis(long defaultRabbitMqCtlTimeoutInMillis)
@Beta public EmbeddedRabbitMqConfig.Builder rabbitMqServerInitializationTimeoutInMillis(long rabbitMqServerInitializationTimeoutInMillis)
@Beta public EmbeddedRabbitMqConfig.Builder erlangCheckTimeoutInMillis(long erlangCheckTimeoutInMillis)
public EmbeddedRabbitMqConfig.Builder downloadFrom(ArtifactRepository repository)
Default is OfficialArtifactRepository.RABBITMQ
OfficialArtifactRepositorypublic EmbeddedRabbitMqConfig.Builder downloadFrom(URL downloadSource, String appFolderName)
downloadSource - the URL from which to download the OS-specific artifact. For example: https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_6_5/rabbitmq-server-generic-unix-3.6.5.tar.xzappFolderName - this is the name of the folder under which all application files are found. For example,
rabbitmq-server-generic-unix-3.6.5.tar.xz extracts everything into to rabbitmq_server-3.6.5/*. Therefore, the value here should be "rabbitmq_server-3.6.5"version(Version)public EmbeddedRabbitMqConfig.Builder version(Version version)
PredefinedVersion establishes the download URL using the official RabbitMQ artifact repository,
the appropriate artifact type depending on the current Operating System, and information about the extraction
folder. Use BaseVersion if the version you look for isn't predefined but the artifact still follows
the expected distribution conventions.
Default value if none is specified: PredefinedVersion.LATEST
downloadFrom(URL, String)public EmbeddedRabbitMqConfig.Builder downloadFolder(File downloadFolder)
If the folder doesn't already exist, it will be created.
By default, the download folder will be: ~/".embeddedrabbitmq", while the file name will match the remote artifact's name (as defined by the download URL).
Use the downloadTarget(File) method to specify a file as destination instead of a folder, but not both.
public EmbeddedRabbitMqConfig.Builder downloadTarget(File downloadTarget)
If the file already exists, it will be overwritten.
Use downloadFolder(File) to define a folder instead of a file if necessary, but not both.
By default, the download folder will be: ~/".embeddedrabbitmq", while the file name will match the remote artifact's name (as defined by the download URL).
public EmbeddedRabbitMqConfig.Builder extractionFolder(File extractionFolder)
By default, the artifact will be extracted to Java's Temp folder.
SystemUtils.JAVA_IO_TMPDIRpublic EmbeddedRabbitMqConfig.Builder useCachedDownload(boolean cacheDownload)
Default value is true
public EmbeddedRabbitMqConfig.Builder deleteDownloadedFileOnErrors(boolean deleteCachedFile)
Default value is true
public EmbeddedRabbitMqConfig.Builder envVar(String key, String value)
public EmbeddedRabbitMqConfig.Builder envVar(RabbitMqEnvVar key, String value)
Use envVar(String, String) to define a variable that's not predefined in the RabbitMqEnvVar enum
public EmbeddedRabbitMqConfig.Builder port(int port)
The port is defined by setting the environment variable RabbitMqEnvVar.NODE_PORT
port - any valid port number or -1 to use any random available port (same as randomPort())public EmbeddedRabbitMqConfig.Builder randomPort()
The port is defined by setting the environment variable RabbitMqEnvVar.NODE_PORT
public EmbeddedRabbitMqConfig.Builder envVars(Map<String,String> map)
public EmbeddedRabbitMqConfig.Builder processExecutorFactory(RabbitMqCommand.ProcessExecutorFactory factory)
public EmbeddedRabbitMqConfig.Builder downloadProxy(String hostname, int port)
public EmbeddedRabbitMqConfig.Builder downloadProxy(Proxy downloadProxy)
public EmbeddedRabbitMqConfig build()
EmbeddedRabbitMqConfig using smart defaults.Copyright © 2016–2021. All rights reserved.