lundi 30 mars 2015

Wait for signal to start activity (amazon Workflow)

I have built a workflow using java flow framework provided by AWS. I have created 4 activities. First activity wait for signal to start. Then all the activities execute synchronously using Promise<> object. Workflow implementation code is following-



public class PaginationWorkflowImpl implements PaginationWorkflow
{
private ManualUploadClient operations0 = new ManualUploadClientImpl();
private DownloadActivityClient operations1 = new DownloadActivityClientImpl();
private ConvertActivityClient operations2 = new ConvertActivityClientImpl();
private UploadActivityClient operations3 = new UploadActivityClientImpl();
final Settable<String> result = new Settable<String>();

public void paginate()
{
Promise<String> UDone = operations0.Upload(result);
Promise<String> dnDone = operations1.s3Download(UDone);
Promise<String> convDone = operations2.pdfToTiff(dnDone);
operations3.s3Upload(convDone);
}

@Override
public void signal1(String data) {
// result.set(data);
//result.Void();
Promise<String> ready = Promise.asPromise("ready");
result.chain(ready);
}


}


Here activity Upload wait for the object result to be in ready state. So when I signal workflow the method signal1 kicks off and puts the object in ready state. But as soon as I signal the workflow, workflow execution get failed.


I am using nodejs aws api to signal workflow. Below is the code for the same-



var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: '', secretAccessKey: ''});
AWS.config.update({region: 'us-east-1'});

var swf = new AWS.SWF();
var params = {
domain: 'HWdemo2', /* required */
signalName: 'signal1', /* required */
workflowId: 'PaginationWorkflow', /* required */
//input: 'true'
//runId: 'STRING_VALUE'
};
swf.signalWorkflowExecution(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});


And the error which I is showing in AWS workflow events console for execution fail is following-





["java.util.concurrent.CancellationException", {
"cause": ["java.lang.NullPointerException", {
"cause": null,
"stackTrace": [{
"methodName": "<init>",
"fileName": null,
"lineNumber": -1,
"className": "java.io.StringReader",
"nativeMethod": false
}, {
"methodName": "createParser",
"fileName": "JsonFactory.java",
"lineNumber": 835,
"className": "com.fasterxml.jackson.core.JsonFactory",
"nativeMethod": false
}, {
"methodName": "readValue",
"fileName": "ObjectMapper.java",
"lineNumber": 2098,
"className": "com.fasterxml.jackson.databind.ObjectMapper",
"nativeMethod": false
}, {
"methodName": "fromData",
"fileName": "JsonDataConverter.java",
"lineNumber": 96,
"className": "com.amazonaws.services.simpleworkflow.flow.JsonDataConverter",
"nativeMethod": false
}, {
"methodName": "signalRecieved",
"fileName": "POJOWorkflowDefinition.java",
"lineNumber": 111,
"className": "com.amazonaws.services.simpleworkflow.flow.pojo.POJOWorkflowDefinition",
"nativeMethod": false
}, {
"methodName": "doExecute",
"fileName": "AsyncDecider.java",
"lineNumber": 417,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecider$1",
"nativeMethod": false
}, {
"methodName": "",
"fileName": "",
"lineNumber": 0,
"className": "--- continuation ---",
"nativeMethod": false
}, {
"methodName": "handleWorkflowExecutionSignaled",
"fileName": "AsyncDecider.java",
"lineNumber": 413,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecider",
"nativeMethod": false
}, {
"methodName": "processEvent",
"fileName": "AsyncDecider.java",
"lineNumber": 251,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecider",
"nativeMethod": false
}, {
"methodName": "decide",
"fileName": "AsyncDecider.java",
"lineNumber": 496,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecider",
"nativeMethod": false
}, {
"methodName": "handleDecisionTask",
"fileName": "AsyncDecisionTaskHandler.java",
"lineNumber": 50,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecisionTaskHandler",
"nativeMethod": false
}, {
"methodName": "pollAndProcessSingleTask",
"fileName": "DecisionTaskPoller.java",
"lineNumber": 201,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.DecisionTaskPoller",
"nativeMethod": false
}, {
"methodName": "run",
"fileName": "GenericWorker.java",
"lineNumber": 94,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.GenericWorker$PollServiceTask",
"nativeMethod": false
}, {
"methodName": "runWorker",
"fileName": null,
"lineNumber": -1,
"className": "java.util.concurrent.ThreadPoolExecutor",
"nativeMethod": false
}, {
"methodName": "run",
"fileName": null,
"lineNumber": -1,
"className": "java.util.concurrent.ThreadPoolExecutor$Worker",
"nativeMethod": false
}, {
"methodName": "run",
"fileName": null,
"lineNumber": -1,
"className": "java.lang.Thread",
"nativeMethod": false
}],
"message": null,
"localizedMessage": null,
"suppressed": ["[Ljava.lang.Throwable;", []]
}],
"stackTrace": [{
"methodName": "execute",
"fileName": "POJOWorkflowDefinition.java",
"lineNumber": 66,
"className": "com.amazonaws.services.simpleworkflow.flow.pojo.POJOWorkflowDefinition",
"nativeMethod": false
}, {
"methodName": "doAsync",
"fileName": "AsyncDecider.java",
"lineNumber": 70,
"className": "com.amazonaws.services.simpleworkflow.flow.worker.AsyncDecider$WorkflowExecuteAsyncScope",
"nativeMethod": false
}],
"message": null,
"localizedMessage": null,
"suppressed": ["[Ljava.lang.Throwable;", []]
}]



Can anyone please help me out with this error, Thanks a lot in advance.





Aucun commentaire:

Enregistrer un commentaire