Just curious if we can introduce API to compose sagas. For example in our rental application process we have such sagas:
- application form processing - add row into db, charge fee, generate PDF, send emails
- credit report processing - based on form we sending data into Credit bureau, generating PDFs, etc. adding info to db, etc.
- rental deposit processing - add info to db, charge deposit amount, etc.
These 3 steps in it's own saga since we need to do it independently (eg. ask for credit report again after it was failed on credit bureau side).
But we have high-level super-saga (we name it ApplicationSaga) which runs all this 3 sagas and something more.
Right now we have 2 functions in each saga - run which runs saga independently and process which accept %Sage{}, piping stages and returns it.
But I am curious if it will make sense something like
Sage.run_sub(sage, :credit_report, another_sage, ...). Notice there is another_sage instead of function as 3rd argument.
Basically my idea is to:
- isolate stage names and params between this sagas when it's used as part of another sagas
- isolate saga results. In my "main" saga I don't care about each stage result from sub-saga. I just need final result provided by sub-saga.
Just curious if we can introduce API to compose sagas. For example in our rental application process we have such sagas:
These 3 steps in it's own saga since we need to do it independently (eg. ask for credit report again after it was failed on credit bureau side).
But we have high-level super-saga (we name it
ApplicationSaga) which runs all this 3 sagas and something more.Right now we have 2 functions in each saga -
runwhich runs saga independently andprocesswhich accept%Sage{}, piping stages and returns it.But I am curious if it will make sense something like
Sage.run_sub(sage, :credit_report, another_sage, ...). Notice there isanother_sageinstead of function as 3rd argument.Basically my idea is to: