Retry request for package URL.
This commit is contained in:
Родитель
d7f6f5d0d2
Коммит
b9e5150d80
|
@ -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,20 +281,23 @@ 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"
|
||||
//};
|
||||
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl");
|
||||
try
|
||||
{
|
||||
var requestUri = GetAosRequestUri("data/DataManagementDefinitionGroups/Microsoft.Dynamics.DataEntities.GetExportedPackageUrl");
|
||||
|
||||
var parameters = new { executionId };
|
||||
string parametersJson = JsonConvert.SerializeObject(parameters, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto });
|
||||
var parameters = new { executionId };
|
||||
string parametersJson = JsonConvert.SerializeObject(parameters, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto });
|
||||
|
||||
var response = await PostStringRequestAsync(requestUri, parametersJson);
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
JObject jsonResponse = (JObject)JsonConvert.DeserializeObject(result);
|
||||
string jvalue = jsonResponse["value"].ToString();
|
||||
return new Uri(jvalue);
|
||||
var response = await PostStringRequestAsync(requestUri, parametersJson);
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
JObject jsonResponse = (JObject)JsonConvert.DeserializeObject(result);
|
||||
string jvalue = jsonResponse["value"].ToString();
|
||||
return new Uri(jvalue);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace RecurringIntegrationsScheduler.Forms
|
|||
0,
|
||||
0});
|
||||
this.interval.Minimum = new decimal(new int[] {
|
||||
60,
|
||||
5,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
|
|
Загрузка…
Ссылка в новой задаче