Extensions
You can use extensions to add functionality to the event broker. Examples are the DistributedEventBroker (sending events over process boundaries) and MappingEventBroker (mapping event arguments to other types) extensions. Extensions can also be used to implement logging or take control of exception handling.
The event broker calls methods on each registered extension whenever something interesting happens like an object was registered, an event is fired or a handler throws an exception. Extensions can be registered on the event broker:
Use Extensions for Exception Handling
Extensions provide a simple way to take control over exception handling.
When you call SetHandled()
on the context
then the event broker will not re-throw the exception.
The class EventBrokerExtensionBase
simply implements all methods of IEventBrokerExtension
with
virtual methods so you only have to override the methods you are interested in.
Built-in extensions
Appccelerate contains the following extensions for the event broker:
- Distributed Event Broker: Send events to other processes over WCF, NServiceBus, MassTransit or Rhino ESB
- Mapping Event Broker: Map event arguments of an event onto another type of event arguments.
- Log4Net Logging Extension: logs everything happening on the event broker using log4net (available as source code package so you can adapt it to your needs easily.