All Products
Search
Document Center

Event notification

Last Updated: Jul 11, 2019

HTTP (or HTTPS) callback

How can I resolve the problem where no HTTP callback request is received from ApsaraVideo for VOD when a callback event occurs?

  • In the ApsaraVideo for VOD console, choose Global Settings > Callback. Check whether you have configured the callback service and selected the required callback event. If so, go to the next step.
  • Run the following sample code to check whether a response is sent. If not, check whether your callback message receiving server works properly. Replace http://sample.host.com/processMessage with your callback URL for receiving HTTP messages.
curl -l -i -H "Content-type: application/json" -X POST -d '{"VideoId":"videoId","EventType":"FileUploadComplete","Status":"success","Size":1439213}' http://sample.host.com/processMessage

How long is the timeout period for an HTTP callback request? How many times does ApsaraVideo for VOD resend the callback request upon a callback failure? What is the retry interval?

  • An HTTP callback request times out if ApsaraVideo for VOD does not receive a response within 5 seconds by default. ApsaraVideo for VOD resends the callback request twice. That is, ApsaraVideo for VOD attempts to send a callback request for a total of three times. ApsaraVideo for VOD retries at an interval of 1 second upon a callback failure.

Is an HTTP callback request discarded when the number of retry times exceeds the upper limit? How can I prevent message loss?

  • If your callback message receiving server fails to receive an HTTP callback request due to an application crash, device restart, or unreachable network, the HTTP callback request is discarded when the number of retry times exceeds the upper limit. We recommend that you use the MNS callback method to prevent message loss.

Is HTTP status code 302 supported?

  • The HTTP callback method supports only HTTP status code 200. Both HTTP status codes 301 and 302 are not supported for security reasons.

Why do I receive an HTTP callback request multiple times?

  • ApsaraVideo for VOD considers that an HTTP callback is successful only when it receives HTTP status code 200. If the HTTP status code is not 200 or the callback times out, ApsaraVideo for VOD considers that the callback fails, and resends the callback request. ApsaraVideo for VOD attempts to send a callback request for a total of three times.

What is HTTP authentication?

  • ApsaraVideo for VOD allows you to add a specific signature header to HTTP callback requests. The callback message receiving server verifies the signature to prevent illegal or invalid requests from requesters other than ApsaraVideo for VOD. This feature is called HTTP authentication. You can determine whether to enable HTTP authentication.

MNS callback

Why is there no message in the MNS queue?

  • A message fails to be delivered to the MNS queue in the following scenarios: ApsaraVideo for VOD is unauthorized to access MNS, the MNS endpoint in your submitted ticket is not an Internet endpoint, or the queue name is incorrect.
  • If the time to live (TTL) of a message is too short, the message may have been released before it can be consumed. We recommend that you set the TTL to 3,600 seconds.
  • If the maximum message length is too short, a message may fail to be delivered to the MNS queue. We recommend that you use the default value, that is, 65,536 bytes.

Why do I receive a message multiple times?

  • A message is invisible temporarily for a short period of time after it is consumed. You need to delete the message manually or by calling an API operation. Otherwise, the message can be consumed again after that period of time.

Does the MNS callback method support authentication?

  • ApsaraVideo for VOD can deliver messages to the MNS queue only after being authorized to access MNS. Compared with the HTTP callback method, the MNS callback method is more secure and generally does not require authentication.

In which regions is the MNS callback method available?

  • If you store videos in a region in Mainland China, such as China (Beijing) or China (Shanghai), we recommend that you use an MNS queue in China (Shanghai) because there may be a short latency when you deliver messages to a queue in other regions.
  • If you store videos in Singapore, we recommend that you use an MNS queue in Singapore.
  • If you store videos in Germany (Frankfurt), we recommend that you use an MNS queue in Frankfurt.

Can I use an MNS queue for callback across regions?

  • Yes. For example, you can store and process videos in China (Shanghai) or China (Beijing) and deliver messages to an MNS queue in China (Shenzhen). However, message delivery may be delayed due to network latency. Therefore, we recommend that you deliver messages to an MNS queue in the region where your videos are stored.