spring-modulith
spring-modulith copied to clipboard
Add Spring Cloud Stream Event Externalization support
trafficstars
This pull request adds support for Spring Cloud Stream Externationalization, including serializers/deserializers for Message<?> (generics deserialization) and Avro Playloads.
New Module Addition:
- Added
spring-modulith-events-scsmodule to thepom.xmlfile.
Documentation:
README.mdfor the newspring-modulith-events-scsmodule, detailing its purpose, usage, dependencies, configuration, and event routing.- The contents of this README.md file can be moved to proper documentation if this PR progresses.
Implementation:
MessageEventSerializerclasses for event serialization of genericMessage<?>keeping payload type. [1]AvroEventSerializerclasses for event serialization of Avro Paylods, since Jackson ObjectMapper does not handle well Avro Specific/GenericRecords. [2]- It works both for Avro events or Message with Avro payloads
SpringCloudStreamEventExternalizerclass to handle event externalization using Spring Cloud Stream.EnableSpringCloudStreamEventExternalizationannotation for enabling the event externalization configuration.
Testing
- Testing coverage is 89.2% and 75% for branches coverage
- There is also a playground proyect showcasing the use of Spring Cloud Stream Externationalization with Avro support: https://github.com/EDALearn/EDA-TransactionalOutbox-Modulith-JPA/tree/spring-modulith-PR (branch spring-modulith-PR)