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

AsyncListener/AsyncPublisher supports ElementType.TYPE #865

Closed
madrimas opened this issue Jul 24, 2024 · 6 comments
Closed

AsyncListener/AsyncPublisher supports ElementType.TYPE #865

madrimas opened this issue Jul 24, 2024 · 6 comments
Labels
enhancement New feature or request staged for release

Comments

@madrimas
Copy link

Describe the feature request
AsyncListener/AsyncPublisher should support ElementType.TYPE as a target.

Motivation
In typical projects listeners/publishers are independent beans with dedicated methods for consuming/producing. However, sometimes (In bigger projects) the mechanism for consuming/producing are hidden in SDK/libraries. In that cases only simple POJO classes are representative for consuming/producing in the service. Due to that the mentioned annotations should be placed on class level.

Technical details
Supports for both - method and class - level should be implemented. If supporting both levels at the same time would be to painful, please think about parameter to control the behavior.

Describe alternatives you've considered
I tried to implement the feature as an extension to Springwolf. In fact, adding support to annotate POJO classes is quite simple (however maintaining the extension - with upgrading Springwolf itself - would be painful) but I occunterd problems where annotated classes are not so simple as POJO (e.g. beans). In that cases too deep type resolving are executed and in the end processing is broken with NPE from org.springdoc.core.converters.SchemaPropertyDeprecatingConverter#resolve (resolvedSchema is null).
Maybe supports only for POJO class level would be a good option at least at the start.

What do you think about such feature? Do you see it possible?

@madrimas madrimas added the enhancement New feature or request label Jul 24, 2024
@timonback
Copy link
Member

Hi @madrimas,
great idea. AsyncListener/AsyncPublisher can only be used on methods (and other annotations) at this point.

Just to double check, adding the annotation on the class level, would scan all containing methods of the class. Also, all methods would have the same configuration (channel name, bindings, description, while the payload can be extracted from the concrete method signature).

Actually, Springwolf has this already in mind.
Currently, there is only the method-based channelScanner (and operationScanner as well):

public class AsyncAnnotationChannelsScanner<A extends Annotation> extends AsyncAnnotationScanner<A>

In the case of kafka, a class level scanner already exist. This is probably a good starting point for adding a AsyncAnnotationClassLevel(Channels|Operations)Scanner:

We are happy to assist either on GitHub or on Discord with the implementation of this feature request.

@madrimas
Copy link
Author

Just letting you know.
We've change our approach. Instead of adding a Springwolf annotations to the classes/methods we've implemented the scanners interfaces to include our custom annotations.
Unfortunately the solution is strictly our product-oriented, so it's not suitable for contribution to Springwolf project.

Therefore, we do not plan to make development in this area (at least for now). Thanks for your help!

@timonback
Copy link
Member

Thank you for the update @madrimas .

In case you stumble upon certain fields, etc that are a benefit for Springwolf, let us know.


We also gather info about who is using Springwolf. Please comment your company's name in #342 - if you can.

@timonback
Copy link
Member

Implemented as part of #964

Copy link

The change is staged for release and will be part of the next release.

If you want to try and verify it in your application today,
use the latest 1.X.0-SNAPSHOT build as described in our README.md > Testing SNAPSHOT version

Thank you for the report/contribution!

Copy link

The change is available in the latest release. 🎉

Thank you for the report/contribution and making Springwolf better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request staged for release
Projects
None yet
Development

No branches or pull requests

3 participants