On Monday, June 19, 2017 at 11:15:26 PM UTC+1, Rupert Smith wrote:
>
> On Friday, June 16, 2017 at 5:27:37 PM UTC+1, Mark Hamburg wrote:
>>
>> All that said, I think elmq is really interesting for the case where the 
>> interaction isn't hierarchical.
>>
>
> Yes. In my case I have the Auth module, and other modules using it, which 
> are typically structured like this:
>
> Main
>  - Auth
>  - Other
>

I've now refactored my auth package to not use elmq, but instead have an 
API that is purely specific to what it does. There was no need to have 
message routing that can be runtime dynamic.

It is split into 2 public modules:

Auth - which provides the API most of an application wants to interact 
with. To login, logout etc, and to query a sub-set of the total auth state 
to know what is the current username, what are the current permissions, and 
so on. The remainder of the auth state is fully opaque so that applications 
do not depend on it and the auth package can continue to evolve whilst 
presenting a consistent public API.
AuthController - which is TEA structured. It has an update function which 
accepts the login, logout etc "commands" to update the state. I say 
"commands" in inverted commas because they are not of type Cmd Msg, but of 
type AuthCmd, which is an extra thing any update function requested a 
side-effect on the auth state will return.  This part gets wired in to the 
Elm update cycle of whatever application is consuming the auth package. If 
I need some helper functions to reduce boilerplate that this wiring in will 
entail, they will go in their too.

I still like the idea of a more general purpose 'messaging middleware' for 
Elm, but this just feels simpler and more direct.

I will also now be able to publish it along with the back-end auth 
micro-service, and also an elm-mdl UI for managing accounts, roles, 
permissions etc.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to