Closed churcho closed 5 years ago
@churcho Can you provide a code example of what you're trying to do?
Will see if I can create a gist shortly.
It goes something like this: Create Account and set default parameters If account is admin |> Run stages for setting up admin accounts and sending alerts
If account is client |> Run stages for setting up client including sending welcome mail and sms
The account type status stages/steps are a host of like 4-6 operations so I have abstracted into separate pipelines.
I was wondering if it's possible to do something like link AdminPipeline if: :is_admin_account?
Pipeline links can be conditional, see for example:
defmodule CreateUserPipeline
use Opus.Pipeline
step :do_something
step :do_something_else
link AdminPipeline, if: :is_admin?
end
Alternatively you can use the skip/2
macro:
defmodule CreateUserPipeline
use Opus.Pipeline
step :do_something
step :do_something_else
link AdminPipeline
end
defmodule AdminPipeline
use Opus.Pipeline
skip :ensure_admin, unless: :is_admin?
end
That's exactly what I was looking for.
Is it good practice to pipe a pipeline into another from within a stage? Some sort of conditional link.
My fix right now involves piping the results of one pipeline into another and checking a condition in the second stages first step and either returning pipeline or continuing with the steps.