Retry request for package URL.

This commit is contained in:
Tomek Melissa 2018-04-09 23:30:57 +02:00
Родитель d7f6f5d0d2
Коммит b9e5150d80
6 изменённых файлов: 40 добавлений и 43 удалений

Просмотреть файл

@ -236,10 +236,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns>temp writable cloud url</returns>
public async Task<string> GetAzureWriteUrl()
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetAzureWriteUrl"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetAzureWriteUrl");
string uniqueFileName = Guid.NewGuid().ToString();
@ -266,10 +262,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns>job's execution status</returns>
public async Task<string> GetExecutionSummaryStatus(string executionId)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryStatus"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryStatus");
var parameters = new { executionId };
@ -289,10 +281,8 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns>exorted package Url location</returns>
public async Task<Uri> GetExportedPackageUrl(string executionId)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl"
//};
try
{
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl");
var parameters = new { executionId };
@ -304,6 +294,11 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
string jvalue = jsonResponse["value"].ToString();
return new Uri(jvalue);
}
catch
{
return null;
}
}
/// <summary>
/// Gets execution's summary page Url
@ -312,10 +307,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns>execution's summary page Url</returns>
public async Task<string> GetExecutionSummaryPageUrl(string executionId)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryPageUrl"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExecutionSummaryPageUrl");
var parameters = new { executionId };
@ -355,10 +346,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns></returns>
public async Task<HttpResponseMessage> ImportFromPackage(string packageUrl, string definitionGroupId, string executionId, bool execute, bool overwrite, string legalEntityId)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ImportFromPackage");
var parameters = new
@ -381,10 +368,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns></returns>
public async Task<string> DeleteExecutionHistoryJob(string executionId)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.DeleteExecutionHistoryJob"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.DeleteExecutionHistoryJob");
var parameters = new { executionId };
@ -407,10 +390,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns>export package url</returns>
public async Task<HttpResponseMessage> ExportToPackage(string definitionGroupId, string packageName, string executionId, string legalEntityId, bool reExecute = false)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportToPackage"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportToPackage");
var parameters = new
@ -437,10 +416,6 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
/// <returns>export package url</returns>
public async Task<HttpResponseMessage> ExportFromPackage(string packageUrl, string definitionGroupId, string executionId, bool execute, bool overwrite, string legalEntityId)
{
//var requestUri = new UriBuilder(_settings.AosUri)
//{
// Path = "data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportFromPackage"
//};
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.ExportFromPackage");
var parameters = new

Просмотреть файл

@ -155,7 +155,17 @@ namespace RecurringIntegrationsScheduler.Job
if (executionStatus == "Succeeded" || executionStatus == "PartiallySucceeded")
{
Uri packageUrl = await _httpClientHelper.GetExportedPackageUrl(executionId);
attempt = 0;
Uri packageUrl = null;
do //Potentially endless loop
{
attempt++;
System.Threading.Thread.Sleep(_settings.Interval);
packageUrl = await _httpClientHelper.GetExportedPackageUrl(executionId);
if (Log.IsDebugEnabled)
Log.Debug(string.Format(Resources.Job_0_Trying_to_get_exported_package_URL_Try_1, _context.JobDetail.Key, attempt));
}
while (packageUrl == null);
var response = await _httpClientHelper.GetRequestAsync(new UriBuilder(packageUrl).Uri, false);
if (!response.IsSuccessStatusCode)

9
Job.Export/Properties/Resources.Designer.cs сгенерированный
Просмотреть файл

@ -240,6 +240,15 @@ namespace RecurringIntegrationsScheduler.Job.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Job: {0} Trying to get exported package URL. Try: {1}.
/// </summary>
internal static string Job_0_Trying_to_get_exported_package_URL_Try_1 {
get {
return ResourceManager.GetString("Job_0_Trying_to_get_exported_package_URL_Try_1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Job: {0} was paused because of an error..
/// </summary>

Просмотреть файл

@ -180,4 +180,7 @@
<data name="Job_0_thrown_an_error_1" xml:space="preserve">
<value>Job: {0} thrown an error. Exception : {1}</value>
</data>
<data name="Job_0_Trying_to_get_exported_package_URL_Try_1" xml:space="preserve">
<value>Job: {0} Trying to get exported package URL. Try: {1}</value>
</data>
</root>

Просмотреть файл

@ -28,7 +28,7 @@
</layout>
</appender>
<root>
<level value="INFO"/>
<level value="DEBUG"/>
<appender-ref ref="EventLogAppender"/>
</root>
</log4net>

2
Scheduler/Forms/ExportJob.Designer.cs сгенерированный
Просмотреть файл

@ -189,7 +189,7 @@ namespace RecurringIntegrationsScheduler.Forms
0,
0});
this.interval.Minimum = new decimal(new int[] {
60,
5,
0,
0,
0});