/
EagleML Web Service - Asynchronous Request
EagleML Web Service - Asynchronous Request
To make an asynchronous request, prepare the asynchronous RunTaskRequest message and call the RunTaskRequest method.
GenerateRunTaskRequest method as follows:
//create async runtaskrequest message for making SMF extract
private static eagleSvc.WSRunTaskRequest GenerateRunTaskRequest()
{
//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:SMFEXTRACT01" };
//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 = "ASYNC_SMFIST_EXTRACT" };
eagleML.taskIdentifier = taskIdentifier;
//set TaskTypeEnum
eagleML.taskTypeEnum = eagleSvc.TaskTypeEnum.LOAD;
//create and set task parameters
var taskParameters = new eagleSvc.TaskParameter[4];
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" };
eagleML.taskParameters = taskParameters;
runTaskRequest.EagleML = eagleML;
return runTaskRequest;
}
This method creates an async RunTaskRequest message to run an smf extract.
As soon as the RunTaskRequest message is created, the following request can be executed:
eagleSvc.WSTaskAcknowledgement ack1 = myClient.RunTaskRequest(runTaskRequest);
Execution returns a WS TaskAcknowledgement message, like this one:
GenerateRunTaskRequest method as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eag="http://www.eagleinvsys.com/2011/wsdl/EagleML-2-0" xmlns:eag1="http://www.eagleinvsys.com/2011/EagleML-2-0">
<soapenv:Header/>
<soapenv:Body>
<eag:taskAcknowledgement>
<EagleML eaglemlVersion="2-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="eag1:TaskAcknowledgement">
<eag1:header>
<eag1:messageId>CGIDHAF3LOV7P1VS</eag1:messageId>
<eag1:inReplyTo>ID:SMFEXTRACT01</eag1:inReplyTo>
<eag1:sentBy>http://www.eagleinv.com/</eag1:sentBy>
</eag1:header>
<eag1:taskIdentifier>
<eag1:correlationId>3A381805854D389F</eag1:correlationId>
</eag1:taskIdentifier>
<eag1:isNegative>false</eag1:isNegative>
</EagleML>
</eag:taskAcknowledgement>
</soapenv:Body>
</soapenv:Envelope>
To extract large sets of data, asynchronous requests should be used together with sending the result to an FTP folder.