bringmeister / ddd-with-kotlin Goto Github PK
View Code? Open in Web Editor NEWA demo project to show a Domain Driven Design with Kotlin.
License: MIT License
A demo project to show a Domain Driven Design with Kotlin.
License: MIT License
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.