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

Make EnableRabbitRetryAndDlq applicable to ElementType.ANNOTATION_TYPE #29

Closed
antoniobarcelos opened this issue Dec 16, 2019 · 1 comment

Comments

@antoniobarcelos
Copy link
Contributor

This could be really useful to organize the code because in this way you could define an annotation like this in a configuration package:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@RabbitListener(containerFactory = "event", queues = "${spring.rabbitmq.custom.event.queue}")
@EnableRabbitRetryAndDlq(
        event = "event",
        retryWhen = {},
        discardWhen = {},
        directToDlqWhen = { Exception.class }
)
public @interface EventListener {

}

and the use like this in your application class:

@Service
class MyService {

   @EventListener
   public void onEvent(Event event) {
      //... do something
   }
}
@juliofalbo
Copy link
Contributor

Amazing! Thank you for your contribution!

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

2 participants