Hi Mauro!
We've mailed before (a couple of years ago already... time moves fast). Recently, I've been involved with a new project that needs view model composition. Eventually we ended up writing our own implementation. However, as the project is ending, I still wanted to ask you about some of the ideas behind ServiceComposer so that I can use it in next projects instead of rolling our own.
ServiceComposer without HTTP context
Currently ServiceComposer relies on the HTTP context. However, I often find the need to also have a composition engine outside the HTTP context. For example, Search, Pricing, etc. I do see that you started with ServiceComposer.InMemory years ago. Was the idea to first create a ServiceComposer without HTTP context, and then build a ServiceComposer.AspNetCore on top of that? If so, that would be awesome!
In other words, I'd love to use ServiceComposer for other non-HTTP compositions. There is no HTTP request.
Would love to hear your view on this.
Strongly-typed models
ServiceComposer now supports using strongly typed view models. They have the advantages of strong typing and compiler checks and the disadvantages of a bit of coupling. Our team actually liked this as it was already using strongly typed models, coming from a more monolith codebase. Also for generating typescript types.
We currently put those ViewModel types in IT/Ops. It introduces a bit of coupling, but we are ok with that.
The implementation of IEndpointScopedViewModelFactory feels of little bit complicated. I've given you access to the private repo of how we implemented our composition engine. It is not as feature rich as this library, and I think it was version 1, but it shows you how we did it ourselves (I actually didn't code it, but I do like the general idea). It is here: https://github.com/promontis/composition-engine (you should have access now).
Notice the ICompositionRequestHandler<TRequest, TResponse>. So we basically type the Response, but also the Request (this is related to my first question... there is no http context here). Both types end up in IT/Ops. What do you think of this?
Traceability
In a previous project (years ago), I also rolled my own version based on the Workshop code. We also added support to see what data was appended by which appender/subscriber. Might be a nice feature to add.
In my current project we are also talking about generating some picture or doc-site where we show an overview of the routes and what appenders/subscribe are linked to them.
All in all, thanks for the great library! Hope to hear from you.
Hi Mauro!
We've mailed before (a couple of years ago already... time moves fast). Recently, I've been involved with a new project that needs view model composition. Eventually we ended up writing our own implementation. However, as the project is ending, I still wanted to ask you about some of the ideas behind ServiceComposer so that I can use it in next projects instead of rolling our own.
ServiceComposer without HTTP context
Currently ServiceComposer relies on the HTTP context. However, I often find the need to also have a composition engine outside the HTTP context. For example, Search, Pricing, etc. I do see that you started with ServiceComposer.InMemory years ago. Was the idea to first create a ServiceComposer without HTTP context, and then build a ServiceComposer.AspNetCore on top of that? If so, that would be awesome!
In other words, I'd love to use ServiceComposer for other non-HTTP compositions. There is no HTTP request.
Would love to hear your view on this.
Strongly-typed models
ServiceComposer now supports using strongly typed view models. They have the advantages of strong typing and compiler checks and the disadvantages of a bit of coupling. Our team actually liked this as it was already using strongly typed models, coming from a more monolith codebase. Also for generating typescript types.
We currently put those ViewModel types in IT/Ops. It introduces a bit of coupling, but we are ok with that.
The implementation of
IEndpointScopedViewModelFactoryfeels of little bit complicated. I've given you access to the private repo of how we implemented our composition engine. It is not as feature rich as this library, and I think it was version 1, but it shows you how we did it ourselves (I actually didn't code it, but I do like the general idea). It is here: https://github.com/promontis/composition-engine (you should have access now).Notice the
ICompositionRequestHandler<TRequest, TResponse>. So we basically type the Response, but also the Request (this is related to my first question... there is no http context here). Both types end up in IT/Ops. What do you think of this?Traceability
In a previous project (years ago), I also rolled my own version based on the Workshop code. We also added support to see what data was appended by which appender/subscriber. Might be a nice feature to add.
In my current project we are also talking about generating some picture or doc-site where we show an overview of the routes and what appenders/subscribe are linked to them.
All in all, thanks for the great library! Hope to hear from you.