This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.DispatchOrderStagePipeline do | |
use Opus.Pipeline | |
# ... | |
skip if: :job_is_finished? | |
# ... | |
@spec job_is_finished?(map()) :: bool() | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.DispatchOrderStagePipeline do | |
use Opus.Pipeline, instrument?: false | |
# ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.DispatchOrderStagePipeline do | |
use Opus.Pipeline, raise: true | |
# ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Quiqup.DispatchOrderStagePipeline.call(%{order: order}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PipelineInstrumentation do | |
def instrument(:pipeline_started, %{pipeline: Quiqup.DispatchOrderStagePipeline}, %{input: input}) do | |
# publish the metrics to a specific backend | |
end | |
def instrument(:stage_completed, %{stage: %{pipeline: Quiqup.DispatchOrderStagePipeline}}, %{time: time}) do | |
# publish the metrics to a specific backend | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.DispatchOrderStagePipeline do | |
step :persist | |
instrument :stage_completed, %{stage: %{name: :persist}}, fn %{time: time} -> | |
# send to the monitoring tool of your choice | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Quiqup.DispatchOrderStagePipeline.call(%{order: order}, only: [:valid_input?]) | |
Quiqup.DispatchOrderStagePipeline.call(%{order: order}, except: [:push_notification, :emit_event]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.DispatchOrderStagePipeline do | |
use Opus.Pipeline | |
import Quiqup.Notifier, only: [emit_event: 1] | |
check :valid_input?, with: &match?(%{order: _}, &1) | |
check :validate_order, error_message: :order_is_not_valid | |
step :assign_next_stage_slug, raise: true, if: :should_assign? | |
step :assign_courier, instrument?: false | |
step :persist_stage, raise: [PersistanceError] | |
step :push_notification, retry_times: 3, retry_backoff: fn -> lin_backoff(10, 2) |> cap(100) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.PersistCollectStagePipeline do | |
step :persist_stage | |
def call?(%{order: order}) do | |
# check stuff and return true or false | |
end | |
def persist_stage(%{order: order}) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Quiqup.DispatchOrderStagePipeline do | |
# ... | |
link PersistCollectStagePipeline, if: &PersistCollectStagePipeline.call?/1 | |
link PersistPickStagePipeline, if: &PersistPickStagePipeline.call?/1 | |
link PersistPayStagePipeline, if: &PersistPayStagePipeline.call?/1 | |
# ... | |
end |
NewerOlder