Example usage for com.amazonaws.services.elastictranscoder.model Notifications Notifications

List of usage examples for com.amazonaws.services.elastictranscoder.model Notifications Notifications

Introduction

In this page you can find the example usage for com.amazonaws.services.elastictranscoder.model Notifications Notifications.

Prototype

Notifications

Source Link

Usage

From source file:com.amediamanager.config.ElasticTranscoderPipelineResource.java

License:Apache License

private String provisionPipeline() {
    String pipelineId = config.getProperty(ConfigProps.TRANSCODE_PIPELINE);

    if (pipelineId == null) {
        LOG.info("Provisioning ETS Pipeline.");
        state = ProvisionState.PROVISIONING;
        Notifications notifications = new Notifications()
                .withError(config.getProperty(ConfigProps.TRANSCODE_TOPIC))
                .withCompleted(config.getProperty(ConfigProps.TRANSCODE_TOPIC)).withProgressing("")
                .withWarning("");

        CreatePipelineRequest pipelineRequest = new CreatePipelineRequest()
                .withName("amm-reinvent-pipeline-"
                        + UUID.randomUUID().toString().replace("-", "").substring(0, 18).toUpperCase())
                .withRole(config.getProperty(ConfigProps.TRANSCODE_ROLE))
                .withInputBucket(config.getProperty(ConfigProps.S3_UPLOAD_BUCKET))
                .withOutputBucket(config.getProperty(ConfigProps.S3_UPLOAD_BUCKET))
                .withNotifications(notifications);

        try {//from w  w  w.j  av  a  2 s .  co  m
            CreatePipelineResult pipelineResult = transcoderClient.createPipeline(pipelineRequest);
            pipelineId = pipelineResult.getPipeline().getId();
            LOG.info("Pipeline {} created. Persisting to configuration provider.", pipelineId);
            config.getConfigurationProvider().persistNewProperty(ConfigProps.TRANSCODE_PIPELINE, pipelineId);
        } catch (AmazonServiceException e) {
            LOG.error("Failed creating pipeline {}", pipelineRequest.getName(), e);
            state = ProvisionState.UNPROVISIONED;
        }
    }
    return pipelineId;
}