Hi @abuijze
About EventHandler and EventSourcingHandler.
below is my case.
method A and B is menber of an aggregate.
I annotated EventHandler on method A (parameter is eventA),
and EventSourcingHandler on method B (parameter is eventB) .
After configured and run the app(with no spring,axon core only),
when
apply evnetA method A is triggered,
and aplly evnetB methodB triggered.
also when Aggregate is reloaded, both method A and B triggered
so I'm confused, is there any diff between them.
Hi @wangshihui,
please use the mailinglist ([email protected]) to ask questions.
It's most likely that your eventA and eventB event handler methods are invoked because you're rebuilding aggregate state from your events (which is the essence of event sourcing). Axon is applying past event to your aggregate to reconstruct it's state.
Technically, @EventSourcingHandler and @EventHandler are _exactly_ identical. They merely have different names to allow you to be explicit about the intent of the handlers. I recommend using @EventSourcingHandler in your Aggregates, and @EventHandler on the beans that create projections.
@ProjectionHandler or @Projection might have been a better name then for
@EventHandler, stating its intent more clearly. The naming similarity
confused me also in the beginning, I am used to it now but find myself
having to explain it again and again to other devs.
On Mon, Jun 19, 2017 at 9:33 AM Allard Buijze notifications@github.com
wrote:
Hi @wangshihui https://github.com/wangshihui,
please use the mailinglist ([email protected]) to ask
questions.It's most likely that your eventA and eventB event handler methods are
invoked because you're rebuilding aggregate state from your events (which
is the essence of event sourcing). Axon is applying past event to your
aggregate to reconstruct it's state.Technically, @EventSourcingHandler and @EventHandler are exactly
identical. They merely have different names to allow you to be explicit
about the intent of the handlers. I recommend using @EventSourcingHandler
in your Aggregates, and @EventHandler on the beans that create
projections.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/AxonFramework/AxonFramework/issues/370#issuecomment-309361279,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAL1ABocuTi4XCsquJLl1DmahkO6tUhvks5sFiQ2gaJpZM4N9f7t
.
Thanks for your answer @abuijze https://github.com/abuijze @jorgheymans.
And sorry for make question in Issues.
I read the source code and found the same processes of EventHandler and EventSourcingHandler by the axon framework. But can’t sure ,it seams that they can replaced by each other , so it confused me.
Now I can sure EventHandler and EventSourcingHandler are identical technically.
BR
王世辉
邮箱:[email protected] wangshihui_1985@163.com
发件人: bounces+848413-0c2c-wangshihui_1985=163.[email protected] [mailto:[email protected]] 代表 Allard Buijze
发送时间: 2017年6月19日 15:33
收件人: AxonFramework/AxonFramework AxonFramework@noreply.github.com
抄送: wangshihui wangshihui_1985@163.com; Mention mention@noreply.github.com
主题: Re: [AxonFramework/AxonFramework] diff between EventHandler and EventSourcingHandler (#370)
Hi @wangshihui https://github.com/wangshihui ,
please use the mailinglist ([email protected] axonframework@googlegroups.com ) to ask questions.
It's most likely that your eventA and eventB event handler methods are invoked because you're rebuilding aggregate state from your events (which is the essence of event sourcing). Axon is applying past event to your aggregate to reconstruct it's state.
Technically, @EventSourcingHandler and @EventHandler are exactly identical. They merely have different names to allow you to be explicit about the intent of the handlers. I recommend using @EventSourcingHandler in your Aggregates, and @EventHandler on the beans that create projections.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/AxonFramework/AxonFramework/issues/370#issuecomment-309361279 , or mute the thread https://github.com/notifications/unsubscribe-auth/AJQo-oIlP4nVI4CfouXXftHaboASuCARks5sFiQ5gaJpZM4N9f7t . https://github.com/notifications/beacon/AJQo-t746S4LxlT6tVdZOmRWmoX-7tRCks5sFiQ5gaJpZM4N9f7t.gif
@jorgheymans, actually, you can make your own annotation, such as @ProjectionHandler, and meta-annotate that with @EventHandler. Axon will gladly pick it up as an event handler.
Most helpful comment
Hi @wangshihui,
please use the mailinglist ([email protected]) to ask questions.
It's most likely that your eventA and eventB event handler methods are invoked because you're rebuilding aggregate state from your events (which is the essence of event sourcing). Axon is applying past event to your aggregate to reconstruct it's state.
Technically,
@EventSourcingHandlerand@EventHandlerare _exactly_ identical. They merely have different names to allow you to be explicit about the intent of the handlers. I recommend using@EventSourcingHandlerin your Aggregates, and@EventHandleron the beans that create projections.