Expand my Community achievements bar.

SOLVED

split actions or not?

Avatar

Community Advisor

Working on an app with following steps

1) fetch data from external API

2) write data to Adobe Analytics

 

currently I only have one action that both makes the fetch request and later the push data request. but I think it might be better to have 2 seperate actions, one for the data fetch and the other for the push data. basically passing data to second action (temp storage?) and second actions makes the data push.

this way I might re-use the second action for other data pushes later on - just handing over data and some parameters for the data push and done.

 

but I could as well write modules that are included in the single actions and re-use those for other actions.

 

any feedback what is the better approach? having a single "workflow" approach (get data and push) in one action or separate? if separate, any tips how to hand over the data?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Really good answer from @duypnguyen, unfortunatelly as a comment so I can't mark it as answer - Copy comment her to mark as answer:

 



Good discussions over here. Chaining of action in I/O Runtime (or Openwhisk at its core) is called sequence, which you can read more about here: https://github.com/AdobeDocs/adobeio-runtime/blob/master/reference/sequences_compositions.md#sequenc...

Example of sequence definition in the manifest.yml of a Firefly project:
sequences:
  authenticate:
    actions: 'login, check, redirect'
    web: 'yes'

 

View solution in original post

8 Replies

Avatar

Level 3
@Urs_Boller, How about use of https://github.com/adobe/aio-lib-state as a temporary storage, we are planning something similar.

Avatar

Community Advisor
@eldhov19157560 ok, I can temp store the data. but question is: do I write one or two actions? if there are two actions, how do I trigger the second action from within the first action?

Avatar

Level 3
hi @Urs_Boller, the doc says we can do the chaining of actions, but we have not tried yet.

Avatar

Community Advisor

@eldhov19157560 do you have a link for the action chaining?

Avatar

Employee

Good discussions over here. Chaining of action in I/O Runtime (or Openwhisk at its core) is called sequence, which you can read more about here: https://github.com/AdobeDocs/adobeio-runtime/blob/master/reference/sequences_compositions.md#sequenc...

Example of sequence definition in the manifest.yml of a Firefly project:

sequences:
  authenticate:
    actions: 'login, check, redirect'
    web: 'yes'

Avatar

Community Advisor
@duypnguyen thanks for the hint with sequences. Assume I have such a sequence, how do I pass data from one action to the other?

Avatar

Employee
@Urs_Boller, the returned payload of your first action would be in the input params of your second, and so on. The returned output of the last action in the sequence would be its response payload in the end.

Avatar

Correct answer by
Community Advisor

Really good answer from @duypnguyen, unfortunatelly as a comment so I can't mark it as answer - Copy comment her to mark as answer:

 



Good discussions over here. Chaining of action in I/O Runtime (or Openwhisk at its core) is called sequence, which you can read more about here: https://github.com/AdobeDocs/adobeio-runtime/blob/master/reference/sequences_compositions.md#sequenc...

Example of sequence definition in the manifest.yml of a Firefly project:
sequences:
  authenticate:
    actions: 'login, check, redirect'
    web: 'yes'