examples/samples/retrypolicysample.js
function setRetries() {
  console.log('Starting Sample 1 - setRetries.');

  // By default, no retry will be performed with all kinds of services created
  // by Azure storage client library for Node.js.
  var blobServiceWithoutRetry = azure.createBlobService();
  console.log('BlobService instance created, no retry will be performed by default.');

  // There are two pre-written retry policies: ExponentialRetryPolicyFilter
  // and LinearRetryPolicyFilter can be used with modifiable settings.
  // Use an exponential retry with customized settings.
  var fileServiceWithExponentialRetry = azure.createFileService().withFilter(
    new azure.ExponentialRetryPolicyFilter(
      3, // retryCount is set to 3 times.
      4000, // retryInterval is set to 4 seconds.
      3000, // minRetryInterval is set to 3 seconds.
      120000 // maxRetryInterval is set to 120 seconds.
    ));
  console.log('FileService instance created and associated with ExponentialRetryPolicyFilter.');
  console.log(' Retries will be performed with exponential back-off.');

  // Use a default linear retry policy.
  var tableServiceWithLinearRetry = azure.createTableService().withFilter(
    new azure.LinearRetryPolicyFilter()); // By default, retryCount is set to 3 times and retryInterval is set to 30 seconds.
  console.log('TableService instance created and associated with LinearRetryPolicyFilter,');
  console.log(' Retries will be performed with linear back-off.');

  console.log('Ending Sample 1 - setRetries.');
}
function setRetries() {
  console.log('Starting Sample 1 - setRetries.');

  // By default, no retry will be performed with all kinds of services created
  // by Azure storage client library for Node.js.
  var blobServiceWithoutRetry = azure.createBlobService();
  console.log('BlobService instance created, no retry will be performed by default.');

  // There are two pre-written retry policies: ExponentialRetryPolicyFilter
  // and LinearRetryPolicyFilter can be used with modifiable settings.
  // Use an exponential retry with customized settings.
  var fileServiceWithExponentialRetry = azure.createFileService().withFilter(
    new azure.ExponentialRetryPolicyFilter(
      3, // retryCount is set to 3 times.
      4000, // retryInterval is set to 4 seconds.
      3000, // minRetryInterval is set to 3 seconds.
      120000 // maxRetryInterval is set to 120 seconds.
    ));
  console.log('FileService instance created and associated with ExponentialRetryPolicyFilter.');
  console.log(' Retries will be performed with exponential back-off.');

  // Use a default linear retry policy.
  var tableServiceWithLinearRetry = azure.createTableService().withFilter(
    new azure.LinearRetryPolicyFilter()); // By default, retryCount is set to 3 times and retryInterval is set to 30 seconds.
  console.log('TableService instance created and associated with LinearRetryPolicyFilter,');
  console.log(' Retries will be performed with linear back-off.');

  console.log('Ending Sample 1 - setRetries.');
}
function setRetries ( ) { console . log ( 'Starting Sample 1 - setRetries.' ) ; // By default, no retry will be performed with all kinds of services created // by Azure storage client library for Node.js. var blobServiceWithoutRetry = azure . createBlobService ( ) ; console . log ( 'BlobService instance created, no retry will be performed by default.' ) ; // There are two pre-written retry policies: ExponentialRetryPolicyFilter // and LinearRetryPolicyFilter can be used with modifiable settings. // Use an exponential retry with customized settings. var fileServiceWithExponentialRetry = azure . createFileService ( ) . withFilter ( new azure . ExponentialRetryPolicyFilter ( 3 , // retryCount is set to 3 times. 4000 , // retryInterval is set to 4 seconds. 3000 , // minRetryInterval is set to 3 seconds. 120000 // maxRetryInterval is set to 120 seconds. ) ) ; console . log ( 'FileService instance created and associated with ExponentialRetryPolicyFilter.' ) ; console . log ( ' Retries will be performed with exponential back-off.' ) ; // Use a default linear retry policy. var tableServiceWithLinearRetry = azure . createTableService ( ) . withFilter ( new azure . LinearRetryPolicyFilter ( ) ) ; // By default, retryCount is set to 3 times and retryInterval is set to 30 seconds. console . log ( 'TableService instance created and associated with LinearRetryPolicyFilter,' ) ; console . log ( ' Retries will be performed with linear back-off.' ) ; console . log ( 'Ending Sample 1 - setRetries.' ) ; }
Demonstrate how to use pre-written retry policies.
By default, no retry will be performed with service instances newly created.
Several pre-written retry policies are available with modifiable settings,
and can be used through associating filter.
Demonstrate how to use pre - written retry policies . By default no retry will be performed with service instances newly created . Several pre - written retry policies are available with modifiable settings and can be used through associating filter .