docs: updates to several patterns

This commit is contained in:
Ilkka Seppälä
2024-05-28 19:46:39 +03:00
parent 4652842c94
commit 584e949714
70 changed files with 347 additions and 479 deletions
-19
View File
@@ -55,29 +55,14 @@ public class DataBus {
return INSTANCE;
}
/**
* Register a member with the data-bus to start receiving events.
*
* @param member The member to register
*/
public void subscribe(final Member member) {
this.listeners.add(member);
}
/**
* Deregister a member to stop receiving events.
*
* @param member The member to deregister
*/
public void unsubscribe(final Member member) {
this.listeners.remove(member);
}
/**
* Publish an event to all members.
*
* @param event The event
*/
public void publish(final DataType event) {
event.setDataBus(this);
@@ -163,10 +148,6 @@ When the data bus publishes a message, the output is as follows:
As shown, `MessageCollectorMembers` only accept messages of type `MessageData`, so they do not see the `StartingData` or `StoppingData` messages, which are only visible to `StatusMember` (the event administrators or organizers). This selective message handling prevents ordinary community members from receiving administrative notifications.
## Class diagram
![Data Bus](./etc/data-bus.urm.png "Data Bus pattern")
## Applicability
* When multiple components need to share data or events but direct coupling is undesirable.