Umbrella: JSON rendering in domain or web app

Hi

Say I have umbrella apps Core and Web

The Core app contains all the models, services and other domain-specific functionality. The Web app contains the router, controllers, channels and views. Web depends on Core.

When a request comes in, the Web app calls the Core app which returns a struct that the Web app then uses to construct a JSON response from a view.

Now, say I want to add a third app Dispatcher which manages an external queue system (redis/kafka etc). For every model change in the Core app, it calls Dispatcher and puts the event/model data on the queue.

Furthermore, I want each message on the queue to be the same format as the ones specified in the Web views/JSON responses. Problem is that this causes a cyclical dependancy between Core and Web.

My question is, does it make sense to move the JSON rendering into the Core app, or is there a better solution to avoid the cyclical dependancy?

2 Likes