Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public class BatchClientFactory
  2. {
  3. private IBatchClientConfigurationSettingsRetriever batchClientConfigurationSettings;
  4. private BatchClient batchClient;
  5.  
  6. public BatchClientFactory(IBatchClientConfigurationSettingsRetriever configurationSettingsRetriever)
  7. {
  8. this.batchClientConfigurationSettings = configurationSettingsRetriever;
  9.  
  10. }
  11. public BatchClient GetBatchClientWithRetry()
  12. {
  13. var retry = new Microsoft.Azure.Batch.RetryPolicyProvider(new ExponentialRetry(TimeSpan.FromSeconds(10), 10));
  14. this.batchClient = BatchClient.Open(
  15. new BatchSharedKeyCredentials(
  16. batchClientConfigurationSettings.GetBatchAccountUri().AbsoluteUri,
  17. batchClientConfigurationSettings.BatchAccountName,
  18. batchClientConfigurationSettings.BatchAccountKey));
  19. batchClient.CustomBehaviors.Add(retry);
  20.  
  21. return batchClient;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement