@SuppressWarnings({ "rawtypes", "unchecked" })
	private void processDeploymentMessage(ResourceDeployer deployer, DeploymentMessage message) {
		DeploymentAction deploymentAction = message.getDeploymentAction();
		String name = message.getUnitName();
		String errorDesc = null;

		try {
			switch (deploymentAction) {
				case create:
				case createAndDeploy: {
					if (deployer instanceof StreamDeployer) {
						deployer.save(new StreamDefinition(name, message.getDefinition()));
					}
					else if (deployer instanceof JobDeployer) {
						deployer.save(new JobDefinition(name, message.getDefinition()));
					}
					if (DeploymentAction.createAndDeploy.equals(deploymentAction)) {
						deployer.deploy(name, Collections.<String, String> emptyMap());
					}
					break;
				}
				case deploy:
					deployer.deploy(name, message.getDeploymentProperties());
					break;
				case undeploy:
					deployer.undeploy(name);
					break;
				case undeployAll:
					deployer.undeployAll();
					break;
				case destroy:
					deployer.delete(name);
					break;
				case destroyAll:
					deployer.deleteAll();
					break;
			}
		}
		catch (Throwable t) {//NOSONAR - ok since it's re-thrown
			errorDesc = ZooKeeperUtils.getStackTrace(t);
			throw t;
		}
		finally {
			writeResponse(message, errorDesc);
		}

	}
Processes the deployment message based on the deployment action.

@param deployer the deployer to use for processing
@param message the deployment message
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/server/admin/deployment/zk/DeploymentMessageConsumer.java