Server Environment
The server conditions and configuration under which the application operates.
Configuration
Some parts of the ServerEnvironment
can be customized based on the
EnvironmentType
. To do so, one of the overloads of the use
method can be called. Two environment types exist out of the box: Tests and DefaultMode. For example:
ServerEnvironment.when(DefaultMode.class)
.use(productionStorageFactory)
.use(memoizingTracerFactory);
ServerEnvironment.when(Tests.class)
.use(testingStorageFactory);
Content copied to clipboard
A custom environment type may also be used:
final class StagingEnvironment extends EnvironmentType {
...
}
ServerEnvironment.when(Staging.class)
.use(inMemoryStorageFactory);
Content copied to clipboard
Staging
is enabled, the specified value is going to be returned on storageFactory.Types
Link copied to clipboard
A function which accepts a class of EnvironmentType and returns a value configured in a
ServerEnvironment
.Link copied to clipboard
Allows to configure values used by the
ServerEnvironment
for the given type.Functions
Link copied to clipboard
Makes the deploymentType return the values from the provided supplier.
Link copied to clipboard
The type of the environment application is deployed to.
Link copied to clipboard
Returns a singleton instance.
Link copied to clipboard
Obtains command scheduling mechanism used by
CommandBus
in this environment.Link copied to clipboard
Returns a storage factory for the current environment, or an empty
Optional
if it was not configured.Link copied to clipboard
Assigns command scheduling mechanism used at this environment by all
CommandBus
instances.Link copied to clipboard
Obtains the storage factory for the current environment.
Link copied to clipboard
Obtains the TracerFactory associated with the current environment, if it was set.
Link copied to clipboard
Obtains the transport factory for the current environment.
Link copied to clipboard
Starts flowing API chain for configuring
ServerEnvironment
for the passed type.