Repository navigation
Returning Non-AggregateRoot Results (e.g., Lists) from MessageHandler: Guidance Needed #2
Unanswered
MstfTurgut
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi Craftgate Modulith Messaging Team! 👋
First, thank you for building this framework—I’m using it for one of my projects, and it’s my first time working with it. I’ve found it really helpful so far, but I’m running into a design question and would appreciate your insights.
Problem Context
I’m using
MessageHandler<M, R>for both commands and queries. For commands (e.g., creating/updating aggregates), it works perfectly. However, for queries (e.g., fetching a list of entities likeList<RoomType>), I’m unable to return results directly becauseRmust extendAggregateRoot.Example Use Case
Attempted Workarounds
Wrapper Class: I created a dummy
AggregateRootwrapper (e.g.,QueryResult<T>) to hold query results.Questions for the Team
AggregateRootresults (e.g., lists/DTOs)?QueryHandlerbase class (withoutAggregateRootor transactional logic) align with the framework’s philosophy?MessageHandlerconstraints?I’m still learning and would appreciate any guidance. Thanks for your time 🙏
All reactions