Skip to content

Instantly share code, notes, and snippets.

@rafaels88
Created September 11, 2018 10:35
Show Gist options
  • Save rafaels88/8eafe1c20105fddbf92d9f419801cc11 to your computer and use it in GitHub Desktop.
Save rafaels88/8eafe1c20105fddbf92d9f419801cc11 to your computer and use it in GitHub Desktop.
Quiqup - Opus Stage Options
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
tee :emit_event, with: &emit_event(&1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment