How to send a job in the backend and refresh status in web app ?

76 views
Skip to first unread message

Luc Larochelle

unread,
May 9, 2019, 4:17:19 PM5/9/19
to Mojolicious
Hi,

I've researched this subject and read a lot, but can't come to a conclusion. I need help to get things straight ... 

In my web app, I simply manage elements in a DB with API endpoints. So far, this is awesome. My setup is Mojolicious + AngularJS + Bootstrap.

The way I see this, my question has 2 approaches :

1) When I add a new element in the table, I'd like to deploy a job, where a backend scripts connects to the element and reports a status to the web app.

2) Some daemon is periodically watching an "inventory" API endpoint and when a new element is detected, the backend script connects to the element and reports a status to the web app.


For instance, it could set a status light for connectivity and authentication success on each line of my table.


In any ways, I thought websockets + minions would be my friends, but the more I read about it, the more I get confused. Are Minions suited for this task ?

How should I achieve this ? 

Luc Larochelle

unread,
May 9, 2019, 4:44:54 PM5/9/19
to Mojolicious
It was implied that the status update would/could be async. 

Luc

Dan Book

unread,
May 9, 2019, 5:21:35 PM5/9/19
to mojol...@googlegroups.com
Pubsub over a db like Pg or Redis might be useful if you are using one of those. Otherwise the Mercury websocket broker can also act as a pubsub daemon.

-Dan

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious...@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/ccfe44d6-38b8-405d-92f6-189f4c377b3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luc Larochelle

unread,
May 10, 2019, 11:20:10 AM5/10/19
to Mojolicious
I'm using Mojo::SQLite to address BD needs. The Mercury websocket broker seems an accurate choice, though. 



On Thursday, 9 May 2019 17:21:35 UTC-4, Dan Book wrote:
Pubsub over a db like Pg or Redis might be useful if you are using one of those. Otherwise the Mercury websocket broker can also act as a pubsub daemon.

-Dan

On Thu, May 9, 2019 at 4:17 PM Luc Larochelle <llaro...@gmail.com> wrote:
Hi,

I've researched this subject and read a lot, but can't come to a conclusion. I need help to get things straight ... 

In my web app, I simply manage elements in a DB with API endpoints. So far, this is awesome. My setup is Mojolicious + AngularJS + Bootstrap.

The way I see this, my question has 2 approaches :

1) When I add a new element in the table, I'd like to deploy a job, where a backend scripts connects to the element and reports a status to the web app.

2) Some daemon is periodically watching an "inventory" API endpoint and when a new element is detected, the backend script connects to the element and reports a status to the web app.


For instance, it could set a status light for connectivity and authentication success on each line of my table.


In any ways, I thought websockets + minions would be my friends, but the more I read about it, the more I get confused. Are Minions suited for this task ?

How should I achieve this ? 

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojol...@googlegroups.com.

Luc Larochelle

unread,
May 15, 2019, 11:58:01 AM5/15/19
to Mojolicious
I need to restart this debate :)

I've been looking into this and found the Multiplex plugin for Mojolicious by Joel Berger. Seems interesting too, but I still need to understand the mechanics of websockets and non-blocking IO and minion jobs ... That's a lot 

So I thought of something else ... What if my webage would automatically refresh every X seconds and after sending a job in the background, the BD would be updated with the job results so that when the api endpoint is read by the client, the data is refreshed ? I feel lazy proposing it, but the other way around sounds like a nightmare (I'm not a developper)

What do you think ?
Reply all
Reply to author
Forward
0 new messages