/
EagleML Web Service - Asynchronous Request with FTP Delivery
EagleML Web Service - Asynchronous Request with FTP Delivery
To run an asynchronous request with FTP delivery a RunTaskRequest message should be prepared and the RunTaskRequest method should be executed.
First of all, add the GenerateFTPRunTaskRequest method:
//create async runtaskrequest message for making SMF extract with FTP delivery
private static eagleSvc.WSRunTaskRequest GenerateFTPRunTaskRequest()
{
//create WSRunTaskRequest object
var runTaskRequest = new eagleSvc.WSRunTaskRequest();
//create RunTaskRequest object
var eagleML = new eagleSvc.RunTaskRequest();
//create header section
var header = new eagleSvc.RequestMessageHeader();
//set messageId
header.messageId = new eagleSvc.MessageId { Value = "ID:FTPSMFEXTRACT01" };
//set sendBy
header.sentBy = new eagleSvc.MessageAddress { Value = "user" };
//set sendTo , sendTo must be http://www.eagleinvsys.com/eagle_ml-2-0_default_cm_control_message
header.sendTo = new eagleSvc.MessageAddress[1] { new eagleSvc.MessageAddress { Value = "http://www.eagleinvsys.com/eagle_ml-2-0_default_cm_control_message" } };
//set timestamp
header.creationTimestamp = DateTime.Now;
eagleML.header = header;
//create taskidentifier section
var taskIdentifier = new eagleSvc.TaskIdentifier();
//set correlationId, must be unique
taskIdentifier.correlationId = new eagleSvc.CorrelationId { correlationIdScheme = "correlationIdScheme", Value = GenerateUID() };
//set businessTaskId
taskIdentifier.businessTaskId = new eagleSvc.CorrelationId { correlationIdScheme = "businessTaskIdScheme", Value = "FTP_SMFIST_EXTRACT" };
eagleML.taskIdentifier = taskIdentifier;
//set TaskTypeEnum
eagleML.taskTypeEnum = eagleSvc.TaskTypeEnum.LOAD;
//create and set task parameters
var taskParameters = new eagleSvc.TaskParameter[5];
taskParameters[0] = new eagleSvc.TaskParameter { name = "ActionType", dataType = eagleSvc.DataTypeEnum.S, value = "EXTRACT" };
taskParameters[1] = new eagleSvc.TaskParameter { name = "StreamName", dataType = eagleSvc.DataTypeEnum.S, value = "eagle_ml-2-0_default_out_q" };
taskParameters[2] = new eagleSvc.TaskParameter { name = "FeedType", dataType = eagleSvc.DataTypeEnum.S, value = "SMFEXTRACT" };
taskParameters[3] = new eagleSvc.TaskParameter { name = "fromdate", dataType = eagleSvc.DataTypeEnum.S, value = "2014-12-04 18-00-00" };
//FTP parameter
taskParameters[4] = new eagleSvc.TaskParameter { name = "DeliveryMethod", dataType = eagleSvc.DataTypeEnum.S, value = "FTP" };
eagleML.taskParameters = taskParameters;
runTaskRequest.EagleML = eagleML;
return runTaskRequest;
}
The method usually matches the method for an asynchronous request, only one extra taskParameter is added:
//FTP parameter
taskParameters[4] = new eagleSvc.TaskParameter { name = "DeliveryMethod", dataType = eagleSvc.DataTypeEnum.S, value = "FTP" };
Now, make an EagleML call:
eagleSvc.WSTaskAcknowledgement ack2 = myClient.RunTaskRequest(runTaskRequest);
The result of execution is a WS TaskAcknowledgement message (it doesn’t differ from the one for asynchronous request usually).
Find your Task in the Message Center Console:
The CorrelationId for this task is 53DF84A29B2C98B6. The extract file should be on FTP in the CMW/extracts folder and have current CorrelationId as a part of its name: