-
Notifications
You must be signed in to change notification settings - Fork 23
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
Handler hell? #39
Comments
Hey Kamil, Yes, I'm certainly interested in supporting that pattern, I think that'd be very helpful. The Regarding the This issue is nicely timed. I recently thought more in the direction of visualizing complex routing to make systems easier to understand, but it would indeed be better if that wasn't so necessary in the first place. Cheers, |
The first one - The second one is more interesting, and more useful too. I was thinking we could wrap handler function's body into core.async's go wrapper, and then, in I can try to find some time to look at it, but I'm not sure I'll have it soon. If you start working on that let me know so we don't overlap, ok? Great, that'd make some of our code much simpler, and we'd still keep the benefits of exchanging separate messages both ways (like inspectability). |
I'd like to ask a question: why do we need 'local' If there's any flaw in my understanding, I'd love a clarification. |
Hi Matthias!
As our app grows, we're getting more and more tired of having commands being one-directional only. That's particularly annoying when commands are used to trigger WebSockets / AJAX requests that should always (in our architecture) get an answer - either confirmation, or some error response.
Currently, the way to handle it is to do something like:
It's fine in such a simple example as above, however, once we have tens of such handlers, it's getting frustrating. It's even more cumbersome if one async action should be taken after first one completes, conditionally, etc...
In a perfect world, I'd love to just write:
That's obviously not so easy with current systems-toolbox architecture. First of all, it'd require response to be routed back correctly to the place it originated, which means
put-fn2
, or switchboard routing, would need to do some magic (that could of course be done manually too, but it'd be nice to have:cmd/route-bidirectional
that'd work like a pair of:cmd/route
's that have:from
: and:to
reversed). Also,put-fn2
would need to receive the response and return it.However, it'd make it possible to write complex asynchronous logic in a synchronous fashion, and that's a big deal. What I described here is pretty much what generators and promises offer in ES6. That's why I used a title "handler-hell" ;)
What are your thoughts about it? Is that something you'd be interested in supporting in systems-toolbox?
Cheers!
The text was updated successfully, but these errors were encountered: