Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What do background and asynchronous really mean? #28

Open
joshco opened this issue May 27, 2017 · 2 comments
Open

What do background and asynchronous really mean? #28

joshco opened this issue May 27, 2017 · 2 comments

Comments

@joshco
Copy link

joshco commented May 27, 2017

I've been experimenting with this gem (very cool!) and can't wrap my head around what background and asynchronous are meant to be used for on Operations.

Background
When background is true, ActiveJob performs the task with a background job. Otherwise it is performed "now", synchronously.

Asynchronous
I don't understand what this does and I can't tell the difference from a workflow perspective.

What I'm looking for
What I was hoping for is a way to configure a workflow, so that if a user attempts to perform an Operation in a way that will not succeed because of dependencies and conditions, that the attempt to complete the operation (say the gem's complete method) would fail. At this point I'd just return the user an error message recommending next steps.

I'd like to avoid having to duplicate these checks both in validations (activerecord) and in the workflow process. Also, the complexity of the dependency relationships is a big reason why I'm looking at rails_workflow.

Could you enlighten us?

@madzhuga
Copy link
Owner

@joshco according to your questions:

  1. A process gets completed when all operations are completed. The engine is ready for using async - I just need to update runners (I don't have it in an open source gem but it was implemented in non-open source versions). Let's say you have order processing workflow. It processes orders and one operation starts subprocess which covers storage provisioning. Order process (parent process) doesn't care for it - it just starts it as a child process but doesn't need to wait for this child process to complete. If you mark the operation as an async - process will be able to complete having this operation still in progress. Most common usage is for subprocess operations - they start subprocesses and parent process doesn't need to wait for child process to complete of async subprocesses.

  2. If you want to have some validations before completing operation - there are at least three ways to implement it. You can contact me in skype (maxim.madzhuga) - and I will be able to describe them and answer your questions.

  3. I tried to implement pretty simple dependency resolution here in rails_workflow engine - let me know if something looks complex to you :)

Do you have any other questions? Some of non-opensorce realizations of an engine were modified to cover complex errors management, configuration caching, user groups/roles permission etc.

@madzhuga
Copy link
Owner

@joshco I am trying to get some feedback from people using rails_workflow - can you contact me (maximmadzhuga@gmail.com)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants