1

I am working with amazon-swf.

I have 4 activities. They are all asynchronous.

The workflow is started from the frontend via a rest api call.

I want to return the results of all 4 activities as the response to the api call.

Since the @execute method cannot return anything apart from void when called from the external client, I am not able to get the result of all 4 activities in my workflow starter program.

One way to solve the problem was to keep polling the workflow history in the starter program, but I really don't think that is best solution. So, what is the efficient way to do it? I am sure almost everyone who uses amazon-swf has a similar use-case.

PS: Rest of my program works fine. I get the results of the all activities in the decider's implementation. But I just can't get them in the program that started the workflow.

Chirag Agrawal
  • 323
  • 3
  • 14

1 Answers1

0

The standard pattern in to run special notification activity in the frontend process. When workflow is started it gets notification activity task list name as a parameter. Then upon completion it schedules the activity into the specified task list. The API call waits for activity invocation that delivers results of the execution. To ensure that workflow doesn't get stuck if frontend process fails specify short schedule to start timeout for such activity.

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35
  • Thanks a lot. Is there any sample code for this? I am fairly new to SWF and I don't exactly know how to code what you have written. – Chirag Agrawal Mar 06 '16 at 06:15