To take this farther along...
You need to consider a few things in addition to the "subscription" you mention above:
- The event itself. This is often expressed in a state diagram. After all, the event should cause some kind of (state) transition to take place someplace. If not why expose the event at all? UML provdes specific elements to cover this, and these are available in EA.
- The trigger for the event. You might want to look at this in an activity diagram. The trigger is actually a kind of action, which (in an activity diagram) can be expressed as: do/^eventName... You could elaborate this further as an Action element if need be.
- You can express an event as a class (such as a C# delegate or eventhandler), as an operation (the handler routine within its an implementing class such as a Windows Form), or as a specialized variant of either of the above. Do what's best for your environment and the system you are modelling.
All that out of the way, let's get back to your sequence diagram...
Consider how you expect things to happen. Do you anticipate that the action of subscription will somehow lead (more or less directly) to the event being triggered? If so you will want to have a sequence diagram to cover this cause and event relationship between the participating entities. If not then a sequence diagram could be almost misleading. The sequence diagram
does have a time axis, and this
does state that some things happen before others (jsut as you would need to subscribe to an event before you could be notified). However, the sequence diagram is best used to show how a set of directly related actions will occur, and how the various entities are related during the time period when the actions are occurring.
Unless there is a fairly tight coupling between the subscription and events occurring you should reconsider the sequence diagram. For expample, if you declare your event handlers about the time that you create the various objects within your system, and then leave them to interact through the lifetime of the system, this indicates a relationship (as above) between the various entities, but not a specific sequence of action-reaction. Use state, activity, and class diagrams to illustrate the various relationships.
However, if you periodically subscribe and unsubscribe to events in the hope of catching them only when the time is right, then you might want to illustrate (both) these processes with sequence diagrams
in addition to the State, Activity and structural viewpoints. Be aware that there is very little (if any) code that can be inferred from these diagrams that is not best shown in the others; if there is anything new here (in the sequences), you might want to revisit the others to see what details you missed there.
HTH, David