yukster

yukster

Thoughts/suggestions for a complex Oban Pro Worklow

I’m looking for thoughts on how to best handle an expansion I need to work into a current Oban.Pro.Workers.Workflow we have in place to handle order payment verfication and publishing logic:

This OrderCreated workflow has three steps:

  1. job to poll for a record’s status being changed due to separate async webhook job handling that payment event

  2. job for recording some data and updating the order status accordingly

  3. job to publish the order on our internal bus

I’m working on incorporating checking some risk analysis data in certain cases. My first blush approach is adding the “certain cases” config and checking that in job #2. If we think the risk data warrants manual review we stamp that status on the order and kill the workflow. This prevents publishing, which is definitely what we want until the manual review is done.

My thought going forward is to queue a new job that polls for a new notification (another webhook) indicating that the manual check is done. That could even be another Workflow… but it seems like it would be very similar to this current workflow. I wonder if I’m missing something about Oban.Pro.Workfows though? Some way to send it back to the polling step?

I suppose I could use the dynamic appending feature to inject an alternate set of steps into the workflow if we need to do the risk analysis. The original step 2 would stay as-is for the non-analysis case but the risk flow would do a separate step 2 that checks if we need manual review and then start a polling job (ie: with a backoff) until we get the approval wehhook (or it times out).

One question I have that I don’t think the docs cover is can I add a worker dynamically to a Workflow from within a job in the workflow? If so, that would be an alternative to checking the configuration at the time the workflow is queued. Not sure if it would be better though.

I asked this in Slack and someone suggested I look at Oban.Pro.Workers.Chain instead of Workflow and on a quick glance it does look like, in the case of manual risk review, I could snooze the workflow for X amount of time. I’ll take a closer look at that but I still wanted to post this here on the forum, both to get more :eyes: and simply because Parker asked me to. :slight_smile:

Thanks!

Most Liked

yukster

yukster

Thanks! After further reflection and digging into how the results of the analysis are processed, I’m now thinking I may not need to append a job after all. It seems like this initial workflow can just finish and there are separate jobs/workflows that handle the results of the analysis. But good to know the details you present here. Cheers.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement