Class DefaultStreamService
java.lang.Object
org.springframework.cloud.dataflow.server.service.impl.DefaultStreamService
- All Implemented Interfaces:
StreamService
Performs manipulation on application and deployment properties, expanding shorthand
application property values, resolving wildcard deployment properties, and creates a
StreamDeploymentRequest.
The StreamService deployer is agnostic. For deploying streams on Skipper use
the DefaultStreamService.
- Author:
- Mark Pollack, Ilayaperumal Gopinathan, Christian Tzolov, Gunnar Hillert, Chris Schaefer, Chris Bono
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.springframework.cloud.dataflow.audit.service.AuditRecordServiceprotected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtilsstatic final Stringprotected final StreamDefinitionRepositoryThe repository this controller will use for stream CRUD operations.protected final StreamValidationService -
Constructor Summary
ConstructorsConstructorDescriptionDefaultStreamService(StreamDefinitionRepository streamDefinitionRepository, SkipperStreamDeployer skipperStreamDeployer, AppDeploymentRequestCreator appDeploymentRequestCreator, StreamValidationService streamValidationService, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, StreamDefinitionService streamDefinitionService) -
Method Summary
Modifier and TypeMethodDescriptioncreateStream(String streamName, String dsl, String description, boolean deploy, Map<String, String> deploymentProperties) Create a new stream.createStreamDefinition(String streamName, String dsl, String description) voidDelete all streams, including undeploying.voiddeleteStream(String streamName) Delete the stream, including undeloying.voiddeployStream(String streamName, Map<String, String> deploymentProperties) Deploys the stream with the user provided deployment properties.org.springframework.cloud.deployer.spi.app.DeploymentStatedoCalculateStreamState(String name) org.springframework.data.domain.Page<StreamDefinition>findDefinitionByNameContains(org.springframework.data.domain.Pageable pageable, String search) Find stream definitions where the findByTaskNameContains parameterFind a stream definition by name.findRelatedStreams(String streamName, boolean nested) Find streams related to the given stream name.Collection<org.springframework.cloud.skipper.domain.Release>Get stream's deployment historyGet stream information including the deployment properties etc.Return a manifest info of a release version.Collection<org.springframework.cloud.skipper.domain.Deployer>voidrollbackStream(String streamName, int releaseVersion) Rollback the stream to the previous or a specific version of the stream.voidscaleApplicationInstances(String streamName, String appName, int count, Map<String, String> properties) Scale application instances in a deployed stream.Map<StreamDefinition,org.springframework.cloud.deployer.spi.app.DeploymentState> state(List<StreamDefinition> streamDefinitions) Retrieve the deployment state for list of stream definitions.voidundeployStream(String streamName) Un-deploys the stream identified by the given stream name.voidupdateStream(String streamName, String releaseName, org.springframework.cloud.skipper.domain.PackageIdentifier packageIdentifier, Map<String, String> updateProperties, boolean force, List<String> appNames) voidupdateStream(String streamName, UpdateStreamRequest updateStreamRequest) Update the stream using the UpdateStreamRequest.validateStream(String name) Verifies that all apps in the stream are valid.
-
Field Details
-
DEFAULT_SKIPPER_PACKAGE_VERSION
- See Also:
-
streamDefinitionRepository
The repository this controller will use for stream CRUD operations. -
auditRecordService
protected final org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService -
auditServiceUtils
protected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtils auditServiceUtils -
streamValidationService
-
-
Constructor Details
-
DefaultStreamService
public DefaultStreamService(StreamDefinitionRepository streamDefinitionRepository, SkipperStreamDeployer skipperStreamDeployer, AppDeploymentRequestCreator appDeploymentRequestCreator, StreamValidationService streamValidationService, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService, StreamDefinitionService streamDefinitionService)
-
-
Method Details
-
doCalculateStreamState
public org.springframework.cloud.deployer.spi.app.DeploymentState doCalculateStreamState(String name) -
undeployStream
Description copied from interface:StreamServiceUn-deploys the stream identified by the given stream name.- Specified by:
undeployStreamin interfaceStreamService- Parameters:
streamName- the name of the stream to un-deploy
-
scaleApplicationInstances
public void scaleApplicationInstances(String streamName, String appName, int count, Map<String, String> properties) Description copied from interface:StreamServiceScale application instances in a deployed stream.- Specified by:
scaleApplicationInstancesin interfaceStreamService- Parameters:
streamName- the name of an existing stream definition (required)appName- in stream application name to scale (required)count- number of instances for the selected stream application (required)properties- scale deployment specific properties (optional)
-
updateStream
Description copied from interface:StreamServiceUpdate the stream using the UpdateStreamRequest.- Specified by:
updateStreamin interfaceStreamService- Parameters:
streamName- the name of the stream to updateupdateStreamRequest- the UpdateStreamRequest to use during the update
-
updateStream
-
rollbackStream
Description copied from interface:StreamServiceRollback the stream to the previous or a specific version of the stream.- Specified by:
rollbackStreamin interfaceStreamService- Parameters:
streamName- the name of the stream to rollbackreleaseVersion- the version to rollback to (if not specified, rollback to the previous deleted/deployed release version of the stream.
-
state
public Map<StreamDefinition,org.springframework.cloud.deployer.spi.app.DeploymentState> state(List<StreamDefinition> streamDefinitions) Description copied from interface:StreamServiceRetrieve the deployment state for list of stream definitions.- Specified by:
statein interfaceStreamService- Parameters:
streamDefinitions- the list of Stream definitions to calculate the deployment states.- Returns:
- the map containing the stream definitions and their deployment states.
-
manifest
Description copied from interface:StreamServiceReturn a manifest info of a release version. For packages with dependencies, the manifest includes the contents of those dependencies.- Specified by:
manifestin interfaceStreamService- Parameters:
name- the release nameversion- the release version- Returns:
- the manifest info of a release
-
history
Description copied from interface:StreamServiceGet stream's deployment history- Specified by:
historyin interfaceStreamService- Parameters:
releaseName- Stream release name- Returns:
- List or Releases for this release name
-
platformList
- Specified by:
platformListin interfaceStreamService- Returns:
- list of supported deployment platforms
-
info
Description copied from interface:StreamServiceGet stream information including the deployment properties etc.- Specified by:
infoin interfaceStreamService- Parameters:
streamName- the name of the stream- Returns:
- the stream deployment information
-
createStream
public StreamDefinition createStream(String streamName, String dsl, String description, boolean deploy, Map<String, String> deploymentProperties) Description copied from interface:StreamServiceCreate a new stream.- Specified by:
createStreamin interfaceStreamService- Parameters:
streamName- stream namedsl- DSL definition for streamdescription- description of the stream definitiondeploy- iftrue, the stream is deployed upon creation (default isfalse)deploymentProperties- the optional deployment properties to use when the stream is deployed upon creation- Returns:
- the created stream definition already exists
-
createStreamDefinition
-
deployStream
Deploys the stream with the user provided deployment properties. Implementations are responsible for expanding deployment wildcard expressions.- Specified by:
deployStreamin interfaceStreamService- Parameters:
streamName- the name of the streamdeploymentProperties- deployment properties to use as passed in from the client.
-
deleteStream
Delete the stream, including undeloying.- Specified by:
deleteStreamin interfaceStreamService- Parameters:
streamName- the name of the stream to delete
-
deleteAll
public void deleteAll()Delete all streams, including undeploying.- Specified by:
deleteAllin interfaceStreamService
-
findRelatedStreams
Find streams related to the given stream name.- Specified by:
findRelatedStreamsin interfaceStreamService- Parameters:
streamName- name of the streamnested- if should recursively findByTaskNameContains for related stream definitions- Returns:
- a list of related stream definitions
-
findDefinitionByNameContains
public org.springframework.data.domain.Page<StreamDefinition> findDefinitionByNameContains(org.springframework.data.domain.Pageable pageable, String search) Find stream definitions where the findByTaskNameContains parameter- Specified by:
findDefinitionByNameContainsin interfaceStreamService- Parameters:
pageable- Pagination informationsearch- the findByTaskNameContains parameter to use- Returns:
- Page of stream definitions
-
findOne
Find a stream definition by name.- Specified by:
findOnein interfaceStreamService- Parameters:
streamDefinitionName- the name of the stream definition- Returns:
- the stream definition
- Throws:
NoSuchStreamDefinitionException- if the definition can not be found.
-
validateStream
Verifies that all apps in the stream are valid.- Specified by:
validateStreamin interfaceStreamService- Parameters:
name- the name of the definition- Returns:
ValidationStatusfor a stream.
-