Publish event from non aggregate (Axon 3.0.7)

瀏覽次數:219 次
跳到第一則未讀訊息

Nol de Wit

未讀,
2017年12月7日 上午9:16:042017/12/7
收件者:Axon Framework Users
Hi all,

I want one of our saga's to be started by both an event that is published from an aggregate, and from a certain listener that receives messages from an external source/service.

From that listener i'd like to publish an event (in stead of routing it over an aggregate using a command). This listener is obviously not an Aggregate. Is there a way to publish events directly from non-aggregates? It appears eventBus, which I believe is used before Axon 3.x, is not available anymore? What is the best alternative?

Thanks,
Nol 

Allard Buijze

未讀,
2017年12月7日 上午9:35:022017/12/7
收件者:axonfr...@googlegroups.com
Hi Nol,

the EventBus is still present. In fact, the Event Store in Axon 3 is a more specialized implementation of the Event Bus, which doesn't only publish messages, but also store them. If you have messages that you don't want stored in your Event Store, but still published, you can use a wrapper around the EventStorageEngine (check out the FilteringEventStorageEngine class) to define which messages should be stored. Be careful, though: TrackingEventProcessors look at stored events, and will not receive events that have been filtered out.

In your case, just inject the EventBus into the bean that handles the other event, and publish an event based on the incoming one when appropriate.

Cheers,

Allard

Op do 7 dec. 2017 om 15:16 schreef Nol de Wit <nold...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
回覆所有人
回覆作者
轉寄
0 則新訊息