I’m using an umbrella application to give some structure to the code.
Imagine the following general structure
- apps/sales (domain specific application with ecto)
- apps/web_interface (Phoenix application)
- WebInterface.UserChannel (Phoenix Channel)
- WebInterface.SaleView (Phoenix View)
- has a dependency on the sales application
Now when an event such as a new sale occurs in the sales application, I’d like to trigger a message to a user on the WebInterface.UserChannel that is rendered as JSON via the WebInterface.SaleView. But I have to problems:
- The
web _interfaceapplication depends on thesalesapplication so I am unable to make a direct call (since I don’t want a circular dependency). I can create a generic callback method so that I can send any messages I want (e.g. with this approach Best practice for calling a function in another application without defining a dependency) but I don’t really want thesalesapplication to be able to send any message, just a limited subset - Since the Phoenix Views are contained in the
web_interfacethesalesapplication cannot render the sale to JSON by itself.
Since everything (or nearly) everything in these applications are JSON-based rather than HTML-based I’m also starting to question if Phoenix Views are even necessary. Maybe I should just define modules in the sales application that return a purely map/array based rendering of the data.
Does anyone have any thoughts or suggestions?






















