private Module deployStreamModule(CuratorFramework client, String streamName, String moduleType, String moduleLabel,
			RuntimeModuleDeploymentProperties properties) throws Exception {
		logger.info("Deploying module '{}' for stream '{}'", moduleLabel, streamName);

		String streamDeploymentPath = new StreamDeploymentsPath().setStreamName(streamName).setModuleType(moduleType)
				.setModuleLabel(moduleLabel).setModuleSequence(properties.getSequenceAsString())
				.setContainer(this.containerAttributes.getId()).build();

		Module module = null;
		Stream stream = DeploymentLoader.loadStream(client, streamName, streamFactory);
		if (stream != null) {
			ModuleDescriptor descriptor = stream.getModuleDescriptor(moduleLabel);
			module = deployModule(descriptor, properties);

			try {
				// this indicates that the container has deployed the module
				client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(streamDeploymentPath);

				// set a watch on this module in the stream path;
				// if the node is deleted this indicates an undeployment
				client.getData().usingWatcher(streamModuleWatcher).forPath(streamDeploymentPath);
			}
			catch (KeeperException.NodeExistsException e) {
				// This could possibly happen when the container disconnects and reconnects but
				// admin leader was not available to process container removed event.
				logger.info("Module {} for stream {} already deployed", moduleLabel, streamName);
			}
		}
		return module;
	}
Deploy the requested module for a stream.

@param client curator client
@param streamName name of the stream for the module
@param moduleType module type
@param moduleLabel module label
@param properties module deployment properties
@return Module deployed stream module
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/server/container/DeploymentListener.java