https://kotlinlang.org logo
#announcements
Title
# announcements
c

Czar

04/28/2017, 7:01 AM
Seems, while I was sleeping, you guys found some way to solve the problem we were talking about 🙂 My idea was to implement visitor:
Copy code
class Projector {
    fun <T:LoanTransactionEvent> handle(event: T) {
        event.handleWith(this)
    }
}

interface LoanTransactionEvent {
    default void handleWith(Projector projector) {
        // your event-specific stuff here
    }
}
And now you can call it in the loop exactly as @snowe wanted. (I was too lazy to test, so there may be some mechanical errors).
s

snowe

04/28/2017, 2:39 PM
czar: I don't think is going to work. Axon works by using the
@EventHandler
annotation to find methods that might handle events. then it uses a parameter resolver to find if the event fires any of the methods. Since almost all of our events inherit from
LoanTransactionEvent
this would fire for every event instead of just the few events I want it to fire for. 😕
c

Czar

05/01/2017, 6:37 AM
Oh, it's been a while since I've played with Axon, missed that you were using it. Good luck then 🙂
2 Views