Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DomainEventListener located under application or Catalog module fails modulith verification with LoanCreated and Closed from Lending module #2

Open
paguerre3 opened this issue Aug 20, 2024 · 1 comment

Comments

@paguerre3
Copy link

paguerre3 commented Aug 20, 2024

@maciejwalkowiak I really enjoyed the Video but where u able to fully test it? Note I like the concepts provided and agree in most of them but checking DomainEventListener located under application or Catalog module fails modulith verification with the Loan Events from Lending module:

  • Module 'catalog' depends on non-exposed type library.lending.domain.LoanCreated within module 'lending'!
    LoanCreated declares parameter LoanCreated.handle(LoanCreated) in (DomainEventListener.java:0)

Note I logged modules to see further details and I saw no expose, I checked modules dependecies and saw:

Lending

Logical name: lending
Base package: library.lending
Direct module dependencies: none
Spring beans:
o ….application.RentBookUseCase
o ….application.ReturnBookUseCase
o ….domain.LoanRepository

Catalog

Logical name: catalog
Base package: library.catalog
Direct module dependencies: none
Spring beans:
o ….application.AddBookToCatalogUseCase
o ….application.DomainEventListener
o ….application.RegisterBookCopyUseCase
o ….domain.BookRepository
o ….domain.CopyRepository
o ….infrastructure.OpenLibraryBookSearchService

So how can we see LoanCreated and Closed (from Lending Module) in the the Catalog module / application : DomainEventListener if Modulith verification fails because they aren't exposed?

@paguerre3 paguerre3 changed the title DomainEventListener located under application or Catalog module fails modulith verification with the LoanClass from Lending module DomainEventListener located under application or Catalog module fails modulith verification with LoanCreated and Closed from Lending module Aug 20, 2024
@paguerre3
Copy link
Author

paguerre3 commented Aug 21, 2024

@maciejwalkowiak
As a Quick solution I added @NamedInterface in the classes exposed into the Catalog module from Lending module, e.g.:


import org.springframework.modulith.NamedInterface;

@NamedInterface
public record LoanClosed(CopyId copyId) {
}

@maciejwalkowiak ***Please add me as a collaborator and I can commit the solution if u like or explain a better solution because now i see DO Events from domain of Lending exposed to the aplication Layer of Catalog ***

Result:

Logical name: lending
Base package: library.lending
Named interfaces:

  • NamedInterface: name=<>, types=[]
  • NamedInterface: name=domain, types=[ l.d.CopyId, .l.d.LoanClosed, l.d.LoanCreated ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant