Use the agile Framework framework to develop enterprise applicationsProgramA large number of business components are written. These components are inserted into the framework as plug-ins, and the structure is completely decoupled. Although there should be no direct communication between each subsystem according to the SOA design concept, sometimes it may also need to communicate between components, such as with the basic subsystem or workflow component.
To maximize the decoupling between components, agile framework provides an automatic event Connection Mechanism between components (castle also provides eventwiringfacility and provides the same functionality, however, there is a serious bug: if there is a component in the system that has a publish-subscribe relationship with each other, it will lead to an endless loop ).
Using Automatic event connection in Agile framework is very simple. You only need to add the eventpublisher attribute to the published event, and then add the eventsubscriber tag to the subscription method, the framework automatically connects events with the same eventkey:
Public Class Publisher
{
[Eventpublisher ( " Eventkey " , " Description " )]
Public Event Eventhandler < Commoneventargs < String > Eventpublished;
Public Void Raiseevent ( String Data)
{
If (Eventpublished ! = Null )
Eventpublished ( This , New Commoneventargs < String > (Data ));
}
}
Public ClassSubstriber
{
Private StringRecievedargs;
[Eventsubscriber ("Eventkey")]
Public VoidEventsubstribe (ObjectSender, commoneventargs<String>ARGs)
{
Recievedargs=Args. ARGs;
}
}
In this way, when publisher triggers eventpublished, substriber will accept this event.
For more information about agile framework, visit agile lab.