In our first example, we are going to implement a system to send items from generators of events to consumers of events. We're going to use the SubmissionPublisher
class to implement the communication between the producers and the consumers of events.
This class stores the information of every item. Each item contains three attributes:
- The
msg
attribute, to store a message in theEvent
- The
source
attribute, to store the name of the class that produces theEvent
- The
date
attribute, to store the date when theEvent
was produced
You have to declare the three attributes as private and include the methods to get()
and set()
the values of the attributes in the class.