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

feat: interceptor filter pattern for serialization/deserialization common cases such as Message and KStream #441

Merged
merged 16 commits into from
Nov 24, 2023

Conversation

SheheryarAamir
Copy link
Contributor

@SheheryarAamir SheheryarAamir commented Nov 8, 2023

Implement the interceptor filter pattern. Each type has its own class (message, kstream, ...). This allows users to specify their own or (de)activate them. And it opens up the extension point via bean injection and ordering

Relates to #433

Copy link

netlify bot commented Nov 8, 2023

Deploy Preview for springwolf-ui canceled.

Name Link
🔨 Latest commit 89f963f
🔍 Latest deploy log https://app.netlify.com/sites/springwolf-ui/deploys/6560cf30dde282000821383f

@timonback
Copy link
Member

Hi @SheheryarAamir
@sam0r040 and I started on it by converting the SpringPayloadExtractor in core to a spring bean.

The idea is that List-Extractor, Message- (and KStream- in cloud-stream) would implement the newly introduced interface.
The SpringPayloadExtract finds them via dependency injection (List).

This might be a bit more tricky than expected.
Next steps would be:

  • Create a class for the KStream- & Message- each and implement the interface
  • Adapt the SpringPayloadExtract (if needed)

Right now, we are unsure about the best solution.

We can also imagine a single class that does handle all GenericTypes in one. And similar to resilience4j.ignoreException, a user can set the types which should be extracted via configuration:

springwolf:
    ...:
        payloadExtractor:
            types:
                - org.springframework.web.client.HttpServerErrorException
                - java.io.IOException

@timonback timonback marked this pull request as ready for review November 20, 2023 20:31
@SheheryarAamir
Copy link
Contributor Author

thank you @timonback. I have one question, how to extract payload type in we are using custom interface instead of spring message for example MyMessage<String> ?

@timonback
Copy link
Member

Hi, sorry I forgot to update and good question.

I am not sure if the current state is the final idea before the release. I imagine that the map of classes that can be extracted can be passed via properties configuration by the user.
The map is likely also missing some entries. Function, Consumer and Supplier comes to mind. Are you missing some entries?

@SheheryarAamir
Copy link
Contributor Author

No, I dont think of any more entries other than already mentioned. But giving an option to user to put values in map solve most of the problem.
I also like the fasterxml implementation of deserialisers . You can have a look in class SimpleDeserializers of jackson-databind:2.15.2 library

@sam0r040 sam0r040 merged commit 6b7d4b0 into springwolf:master Nov 24, 2023
14 checks passed
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

Successfully merging this pull request may close these issues.

3 participants