Git Product home page Git Product logo

ddd-with-kotlin's Introduction

Bringmeister

ddd-with-kotlin's People

Contributors

jbellmann avatar tuhrig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ddd-with-kotlin's Issues

Use Meta-Annotation to combine multiple annotations.

Hi Thomas,

great to see you liked the idea of removing Guava for handling events.
Regarding your commment:

We didn't want to have two annotations on each listener

That's something I understand and fully agree on. The drawback of the solution from the blog you mentioned above is that all events are now handled asynchronously (noted in the blog, too). I also found the link in the blog post that mentioned a solution for this (having both, sync and async events). But that solution comes with some more configuration overhead that is not really necessary I think.

My proposal would be to use Meta-Annotations instead. Create your own annotation for that, like this one:

@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EventListener
@Async
public @interface AsyncEventListener {

    @AliasFor(annotation = EventListener.class, attribute = "value")
    Class<?>[] value() default {};

    @AliasFor(annotation = EventListener.class, attribute = "classes")
    Class<?>[] classes() default {};

    @AliasFor(annotation = EventListener.class, attribute = "condition")
    String condition() default "";
}

The benefit would be you can drop the special configuration class and the much more useful benefit would be you could control the behaviour (sync/async) on the listeners side. What makes it much more flexible for you.

Try it.
Have fun.
Happy coding.

Jörg

Why do you still use Guavas eventbus for application-internal events?

Hi,
stumbled about your bog posts and this one and came to this repo. Had a look into it and found a configuration for the eventbus provided by guava library. Also used it years ago for application-internal events. But that's not needed anymore. Spring has it's own eventbus since years now and also provide an annotation based model (and I guess that's what you maybe liked on guavas, right?).
Have a look to the well documented feature. And yes, also async event handling is supported. There is no need for guava dependency anymore ( 2.7 MB in size btw. ). At least not for application internal event handling. ;-)

Happy Coding

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.