Aggregating Messages

Topics: Prism v4 - WPF 4
Feb 3, 2012 at 10:32 AM

Hi All,

I'm just in the process of creating a new status bar service to provide progress reporting from background threads with event payloads delivered via the Event Aggregator.

I was wondering what mechanisms other people are using to prioritise / aggregate messages that might be arriving from various processes on background threads in order to show the most important / still relevant messages and proress indication?

Feb 3, 2012 at 5:02 PM


Based on my understanding, the implementation details of the features you are describing will depend mostly of your personal preferences and the requirement of your scenario.

A possible approach could be to create a shared service that could receive the messages for each background thread. This could be done, for example, by making the service subscribe to an event in each thread: when the thread want to publish a message, its event could be raise and it would be handled by the service. As you can define your own payload type for the event, you could, for example, create a payload that could store the message you want to publish and its priority. When the event is raised, the service would receive this information and apply the required logic in the messages to shown them.

For example, if you wish to show the message with the higher priority, you could store the messages published by the threads in a collection inside the service and each time this collection changes you could iterate through it to find the message with the higher priority and show it.

You can find more information about shared services and event aggregation in the following chapter of the prism documentation:

I hope you find this useful,

Damian Cherubini

Feb 6, 2012 at 5:42 PM

Hi Damian,

I had this approach in mind (using a priority mechanism) and ID for publishers.  Thanks for the info.