[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Thu Jun 18 2020

How to use re-transfer to retry transfer errors of successful encoding jobs

ContextLink Icon

Ideally, all parts of a workflow are 100% reliable and work as expected every single time. As we all know, this is not the case and that's why a system has to be designed in a resilient way to make up for the instability of single parts within.

One way in which Bitmovin helps to make the workflow more resilient is the re-transfer functionality. Encoded content is stored on a temporary storage for 72 hours and if anything goes wrong during the transfer to your output storage, it can be retried without needing to re-encode the content.

Basic usageLink Icon

Re-transfer needs to be enabled for your account. Please reach out if you are not sure if it's enabled for you. To get started with using the re-transfer functionality, all you have to do is the following steps shown as example with our Java SDK.

1. Configure the transfer error webhook

Configure the transfer-error webhook to be informed about a transfer problem for a specific encoding.

1Webhook transferErrorWebhook = new Webhook();
2transferErrorWebhook.setUrl("https://yourservice.com/webhooks/transfer-error");
3transferErrorWebhook.setMethod(WebhookHttpMethod.POST);
4transferErrorWebhook = bitmovinApi
5 .notifications
6 .webhooks
7 .encoding
8 .encodings
9 .transferError
10 .createByEncodingId("<INSERT THE ENCODING ID>", transferErrorWebhook);

2. Configure the encoding finished webhook

Configure a webhook to be informed when the transfer retry finished successfully and the encoding status changes.

1Webhook encodingFinishedWebhook = new Webhook();
2encodingFinishedWebhook.setUrl("https://yourservice.com/webhooks/encoding-finished");
3encodingFinishedWebhook.setMethod(WebhookHttpMethod.POST);
4encodingFinishedWebhook = bitmovinApi
5 .notifications
6 .webhooks
7 .encoding
8 .encodings
9 .finished
10 .createByEncodingId("<INSERT THE ENCODING ID>", encodingFinishedWebhook);

3. Trigger the transfer retry

This is how a transfer-error webhook receiving application could look like. Please see the transfer-error webhook specification for details on the webhook payload for access to the information you will need to pass to the next call.

Call the transfer retries endpoint for this encoding ID to start the transfer retry.

1WebhookPayload webhookPayload = getWebhookPayload(); // getWebhookPayload() deserializes the webhook payload into a WebhookPayload object
2String encodingId = webhookPayload.getEncoding().getId();
3TransferRetry transferRetry = bitmovinApi
4 .encoding
5 .encodings
6 .transferRetries
7 .create(encodingId);

4. Success

When the transfer retry finished successfully, all the files should be present in the Output storage that was set for the encoding, and the encoding-finished webhook gets triggered.

SummaryLink Icon

With the examples above you should be able to set up your workflow to handle encodings which are successful but are not able to transfer to your output storage.

This small but impactful change can save significant costs, as you don't have to run the encoding again just for retrying the transfer.

Give us feedback