I’m creating an app where my different components needs to communicate a lot with each other, and also get notified when data from the backend have been refreshed etc.
I’ve used the EventAggregator a lot for that, and it works splendid. Then today when I wanted to dump out all messages to see the flow I found this suggestion. What caught my eye was the ending:
But please don’t go overboard on use of the Event Aggregator! It has its uses, but it is not a message queue, it is one-way only, and I’ve seen it abused far too many times as a communications mechanism between units.
I’m not using it as a message queue, but I am using it extensively “as a communications mechanism between units”. For instance:
Component A updates a configuration value. It publishes “configuration changed”, which is picked up by my API class. The API class does a POST request and when it receives a response it publishes “configuration returned from the backend”. Component A, B and C are all listening for that and updates their configurations accordingly.
The same goes for when a button happens to be in a top right component, I publish a message telling the lower left component that the button have been clicked.
These are all “fire and forget” and a way for me to not tie all components together, or using some shared variable being watched all over the place for changes. It makes sense to me, but now I’m worried there are possible draw backs I haven’t thought about.
So: Am I abusing the poor EventAggregator or is this the intended usage?