

支援終止通知：2025 年 11 月 13 日， AWS 將停止對 Amazon Elastic Transcoder 的支援。2025 年 11 月 13 日之後，您將無法再存取 Elastic Transcoder 主控台或 Elastic Transcoder 資源。

如需轉換至 的詳細資訊 AWS Elemental MediaConvert，請造訪此[部落格文章](https://aws.amazon.com/blogs/media/how-to-migrate-workflows-from-amazon-elastic-transcoder-to-aws-elemental-mediaconvert/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 任務狀態通知
<a name="notifications"></a>

Elastic Transcoder 可以在任務狀態變更時通知您。您可以設定 Elastic Transcoder 傳送下列狀態變更之任何組合 （或無） 的通知給您：
+ **進行中：**Elastic Transcoder 已開始處理管道中的任務。
+ **完成：**Elastic Transcoder 已完成處理管道中的任務。
+ **警告：**Elastic Transcoder 在處理管道中的任務時遇到警告條件。
+ **錯誤：**Elastic Transcoder 在處理管道中的任務時遇到錯誤條件。

Elastic Transcoder 使用 Amazon Simple Notification Service (Amazon SNS) 傳送通知。Amazon SNS 提供各種通知選項，包括傳送訊息至 HTTP 端點、電子郵件地址和 Amazon Simple Queue Service (Amazon SQS) 佇列的功能。如需這些和其他選項的詳細資訊，請參閱 [Amazon Simple Notification Service 開發人員指南](https://docs.aws.amazon.com/sns/latest/dg/)。

通知對於設計事件驅動的應用程式十分實用。若您使用通知來判斷任務完成時間，即可不再使用輪詢，也無須面對輪詢有時會出現的 `Limit Exceeded` 例外狀況 (HTTP 狀態碼 429)。

建立或更新管道時，即可設定通知。對於您提交至該管道的每個任務，Elastic Transcoder 會傳送相關聯的通知。

**重要**  
變更通知時，變更會立即生效。除了變更通知後您提交的任務之外，您已提交且 Elastic Transcoder 尚未開始處理的任務也會受到影響。

若要設定 Elastic Transcoder，以便在使用 Elastic Transcoder API 時通知您任務狀態的變更：

1. 建立一或多個 Amazon SNS 主題，並訂閱每個主題。如需詳細資訊，請參閱 [Amazon Simple Notification Service 文件](https://aws.amazon.com/documentation/sns/)。

   如果您已有要使用的 Amazon SNS 主題，您可以略過此步驟。

1. 建立管道或更新現有管道。對於您要通知的狀態變更 （進行中、完成、警告、錯誤），請指定您在步驟 1 中建立的適用 Amazon SNS 主題。如需詳細資訊，請參閱「[建立管道](create-pipeline.md)」、「[更新管道](update-pipeline.md)」或「[更新管道通知](update-pipeline-notifications.md)」。

1. 透過向 Elastic Transcoder 提交任務來測試 `Progressing`和 `Complete` 狀態的通知。

您也可以使用 Elastic Transcoder 主控台來設定通知。如果您使用 主控台，您可以在建立或更新管道時建立 Amazon SNS 主題。不過，您仍然需要使用 Amazon SNS 主控台、API 或 CLI 來訂閱新主題。

當 Elastic Transcoder 傳送狀態變更的通知給您時，通知中傳回的訊息會以下列 JSON 格式顯示。請注意，訊息包含每個輸出的狀態及任務的狀態：

```
{
   "state" : "PROGRESSING|COMPLETED|WARNING|ERROR",
   "errorCode" : "the code of any error that occurred",
   "messageDetails" : "the notification message you created in Amazon SNS",
   "version" : "API version that you used to create the job",
   "jobId" : "value of Job:Id object that Elastic Transcoder 
             returns in the response to a Create Job request",
   "pipelineId" : "value of PipelineId object 
                  in the Create Job request",
   "input" : {
      job Input settings
   },
   "outputKeyPrefix" : "prefix for file names in Amazon S3 bucket",
   "outputs": [
      {
         applicable job Outputs settings,
         "status" : "Progressing|Complete|Warning|Error"
      },
      {...}
   ],
   "playlists": [
      {
         applicable job playlists settings
      }
   ],
   "userMetadata": {
      "metadata key": "metadata value"
   }
}
```