0

In an activity function we return something by doing

context.done(null, object);

to the durable function where object is my target object to sent.

but when i make my activity function async, i can not use context.done

without context.done how can i send my desired object from activity function?

Nafis Islam
  • 1,483
  • 1
  • 14
  • 34

2 Answers2

1

Just return it. That is, where you would have done context.done(null, object) use return object instead. For multiple output bindings, use object properties as usual. However if you only have a single output binding, you can bind it directly to your return value by setting the binding name in function.json to $return, e.g.

{
    "bindings": [
        {
            'type': ...,
            'direction': 'out',
            'name': '$return'
        },
        ...
    ],
    ...
}
MarkXA
  • 4,294
  • 20
  • 22
1

If we only need to return sth to orchestrator function which calls this activity, a simple return object; is enough. Bindings are useful once we want to output the result to other services like blob storage, http response and so on.

Then in orchestrator, get the object as usual.

var myObject = yield context.df.callActivity(...);
Jerry Liu
  • 17,282
  • 4
  • 40
  • 61