Explain Publishers and Subscribers in Events.

bookmark

Publisher is a class responsible for publishing a message of different types of other classes. The message is nothing but Event as discussed in the above questions.

Class Patient is the Publisher class. It is generating an Event deathEvent, which is received by the other classes.

Subscribers capture the message of the type that it is interested in. Again, Class Insurance and Bank are Subscribers. They are interested in event deathEvent of type void.