CML File Locality

CML files must be persistent (as a file) inorder to be submitted to a Hosted Workflow. That is, the CML must be serialized into a file and submitted as a path to a hosted workflow.

If your workflow implies that a CML file can not be created directly within a cloud storage bucket; a capability within the Hosted Workflow API exists to allow you manipulate a buffer of data containing the CML structure, and then invoke a managed upload capability via the Hosted Worfklow API.

The managed upload capability would upload the buffer of data containing your CML to a managed store you have previously created within Telestream Cloud. The result of this process is a URL that can be submitted to a Hosted Workflow.

This mechanism provides an alternative to creating a CML file locally and then moving this file to Cloud Storage so it can be submitted. This process still moves the file; but it does so in a manner transparent to you.

The following C# code fragment illustrates how to make use of this capability:

// note the CML below is abbreviated for brevity

var cml = @"<? xml version = ""1.0"" encoding = ""utf-8"" ?\>
						< Composition xmlns = ""Telestream.Soa.Facility.Playlist"" \>
							…
						</ Composition \>""";

var apiKey = APIKEY
var storeId = ID of desired STORE
var url = Upload(apiKey, storeId, cml);


//The Upload method is defined as:
static string Upload(string apiKey, string storeId, string buffer)
{
	// Initialize uploader
	var config = new Telestream.Cloud.Upload.Client.Configuration();
	config.ApiKey.Add("X-Api-Key", apiKey);
	var client = new Telestream.Cloud.Upload.Api.UploadApi(config);
	var uploader = new Telestream.Cloud.Uploader.Uploader(client, storeId);

	// Start upload
	var upload = uploader.UploadBuffer(buffer, "input.cml");
	// Wait for upload to finish
	upload.Wait();

	// Fetch url to uploaded file
	var url = uploader.SignedUrl();
	url.Wait();
	return url.Result;
}

The result of the Upload method (the variable: url above ) refers to the PATH that would be specified in the Submit message.

Using this mechanism provides an easy and automated way of dealing with CML data within Buffers and not having to worry about managing the upload of files from a Cloud Storage repository.

NOTE: Files uploaded in this manner are not automatically cleaned up.

Because of this, it is RECOMMENDED that a store be created explicitly for the purpose of uploading. This STORE should correspond to a bucket in cloud storage that has the appropriate LIFECYCLE expiration configured. This way, the cloud provider will manage the cleanup of any files uploaded via this mechanism.

If this is NOT done, then the bucket owner bears the responsibility of cleaning up the files created as a result of this upload process.