UML Composite Structure Diagram Example
Observer pattern is a behavioral software design pattern in which a subject maintains a list of subscribers called observers and notifies them of any state changes usually by calling one of their methods. Once state change notification is received observer can request current state of the subject.
An example of collaboration for Observer design pattern is shown below. Two roles of the collaboration - subject and observer - will be played by instances of classifiers typed by Subject and Observer interfaces. These interfaces can be viewed as a projection of the externally observable features of classifiers playing the roles.
Collaboration example - Observer design pattern
The same collaboration could be shown using alternative notation for properties. Collaboration icon is connected to each of the rectangles denoting interfaces that are types of properties of the collaboration. Each line is labeled by the name of the property (role).
Composite structure example - Observer design pattern
https://www.uml-diagrams.org/observer-pattern-uml-composite-diagram-example.html