Skip to content

v2.0.0 - EventListeners subscribe to multiple Event

Past due by almost 9 years 0% complete

In contrary to CommandHandler which need to handle only one Command in order to maintain SRP, EventListeners should be able to listen to multiple events.

There are many scenario where we need a Listener to listen to more than one vent. For example:

  • when 2 events are quite similar (ex: ItemAddedToChart, ItemRemovedFromChart) we may want to act on both of …

In contrary to CommandHandler which need to handle only one Command in order to maintain SRP, EventListeners should be able to listen to multiple events.

There are many scenario where we need a Listener to listen to more than one vent. For example:

  • when 2 events are quite similar (ex: ItemAddedToChart, ItemRemovedFromChart) we may want to act on both of them (sending an email, ...)
  • for more global actions: AuditLog; EventHistory per user, ...

This will break backward compatibility, be careful when you will upgrade