This dotnet core project contains a simple implementation of an in-memory pub-sub pattern (PubSubSample.Messaging) and a sample application that uses the messaging library.
In this library, we have generic interfaces for publisher and subscription (IPublisher<T>
and ISubscription<T>
). In this design, the Type T
determines the relationship between these two. This means published T1
messages will be received by subscribers of a T1
message but not by subscribers of a T2
message.
The sample application (PubSubSample.SampleApp) accepts first name and last name, then displays two different formats of the complete name. Its usage of the PubSubSample.Messaging library is as follows:
- When the name is read from console, a
Name
object is published. - A display object is subscribed to the
Name
message and displays it in different formats once received.