This topic provides answers to some commonly asked questions about event notifications.
Common questions
How do I obtain HTTPS playback URLs from callbacks?
HTTPS URLs are not returned for HTTP callbacks or Simple Message Queue (formerly MNS) callbacks in ApsaraVideo VOD. You can perform the following steps to obtain HTTPS playback URLs from callbacks:
Configure an SSL certificate for the domain name.
Skip this step if you have configured an SSL certificate for the domain name. For more information about how to configure an SSL certificate, see Enable HTTPS secure acceleration.
In the code that is used to receive callbacks, replace the HTTP playback URL with the HTTPS playback URL.
For example, call the
replace
method in Java code to replace the HTTP URL with the HTTPS URL.
How do I specify multiple callback URLs?
If you configure callbacks by using the ApsaraVideo VOD console or SDK, or by calling the SetMessageCallback operation, the callback settings take effect globally and only one callback URL is available. If you want to specify multiple callback URLs, use one of the following methods:
Method 1: Specify a callback URL in
UserData
Specify the MessageCallback field in
UserData
when you call API operations such as CreateUploadVideo and SubmitTranscodeJobs to configure a callback URL. For more information, see Specify multiple callback URLs.NoteThis method supports only HTTP callbacks.
You must enable global event notifications and configure related events for the HTTP callback settings to take effect.
Method 2: Specify a callback URL for each application
You can use the multi-application system to configure a callback method and URL for each application. For more information, see Overview of the multi-application service.
FAQ about HTTP callbacks
How do I troubleshoot a failure to receive an HTTP callback?
Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose . On the page that appears, check whether the callback feature is enabled and whether you have configured event callbacks based on your business requirements.
Run the following sample code to check whether a response is returned. If no response is returned, check whether errors occur on the server that receives callback messages. In actual use, replace
http://example.aliyundoc.com/processMessage
with the HTTP callback URL that you specified.curl -l -i -H "Content-type: application/json" -X POST -d '{"VideoId":"videoId","EventType":"FileUploadComplete","Status":"success","Size":1439213}' http://example.aliyundoc.com/processMessage
How long is the timeout period for an HTTP callback request? How many times does ApsaraVideo VOD resend the callback request upon a failure? How long is the retry interval?
By default, an HTTP callback request times out if no response is returned within 5 seconds. ApsaraVideo VOD resends the callback request up to three times at an interval of 1 second upon a failure.
Is an HTTP callback request discarded after the number of retries reaches the limit? How do I prevent message loss?
If an error occurs on the server that receives callback messages, such as crash, restart, and network unreachable, the callback request is discarded after the number of retries reaches the limit. We recommend that you use the SMQ callback method to prevent message loss.
Is HTTP status code 302 supported for HTTP callbacks?
The HTTP callback method supports only HTTP status code 200. Other HTTP status codes such as 301 and 302 are not supported for security reasons.
Why does my server receive an HTTP callback request multiple times?
An HTTP callback is successful only if the HTTP status code 200 is returned. If an HTTP status code other than 200 is returned or the callback times out, the callback fails and ApsaraVideo VOD attempts to resend the callback request up to three times.
What is HTTP authentication?
During HTTP authentication, ApsaraVideo VOD allows you to add a specific signature header to HTTP callback requests. The server that receives callback messages verifies the signature to prevent unauthorized requests from requesters other than ApsaraVideo VOD. You can decide whether to enable HTTP authentication.
FAQ about SMQ callbacks
Why does no callback message exist in the SMQ queue?
A callback message fails to be pushed to the SMQ queue due to the following reasons: ApsaraVideo VOD is not authorized to access Simple Message Queue (formerly MNS), the SMQ endpoint is not a public endpoint, or the queue name is invalid.
If the time to live (TTL) of a callback message is too short, the message may be 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, the callback message may fail to be pushed to the SMQ queue. We recommend that you use the default message length of 65,536 bytes.
Why do I receive a message multiple times?
A message is invisible for a short period of time after it is consumed. You must delete the message manually or by calling an API operation. Otherwise, the message can be consumed again after that period.
Does the SMQ callback method support authentication?
ApsaraVideo VOD can push callback messages to an SMQ queue only after ApsaraVideo VOD is authorized to access SMQ. SMQ callbacks are more secure than HTTP callbacks and do not require authentication.
In which regions is the SMQ callback method available?
If you store videos in the Chinese mainland, such as the China (Beijing) or China (Shanghai) region, we recommend that you use an SMQ queue in the China (Shanghai) region. Low latency may occur if you push callback messages to a queue in regions other than the China (Shanghai) region.
If you store videos in the Singapore region, we recommend that you use an SMQ queue in the Singapore region.
If you store videos in the Germany (Frankfurt) region, we recommend that you use an SMQ queue in the Germany (Frankfurt) region.
Can I use an SMQ queue for callbacks across regions?
Yes. For example, you can store and process videos in the China (Shanghai) or China (Beijing) region and push callback messages to an Simple Message Queue (formerly MNS) queue in the China (Shenzhen) region. However, message delivery may be delayed due to network latency. Therefore, we recommend that you push messages to an SMQ queue in the region where your videos are stored.