This project contains sample implementation of topic based PubSubServer pattern. The project consists of three parts
- PubSubServer
- Publisher
- Subscriber
Three parts are developed as Windows forms and communication between these components is done using Windows communication foundation. This document will describe on to test the solution.
You can view requirements for this task here
Once you download the files, you can open the solution in Visual Studio 2015 or above.
Visual Studio solution file path: \PubSubServerExercise\Source\PubSubSample.sln
You can compile the application, it should install the packages from NuGet during compilation. Once solution is compiled, it will produce 3 executables (Windows form applications)
PubSub Server \PubSubServerExercise\Source\PubSubSample.PubSubServer.Host\bin\PubSubSample.PubSubServer.Host.exe
Publisher \PubSubServerExercise\Source\PubSubSample.Publisher.Host\bin\PubSubSample.Publisher.Host.exe
Subscriber \PubSubServerExercise\Source\PubSubSample.Subscriber.Host\bin\PubSubSample.Subscriber.Host.exe
To view the run-time behaviour of the solution, you can click the pre-created bat files located at the path \PubSubServerExercise\Source
.
- 0_Launcher.bat - Clicking this will launch one instance of PubSubServer, Publisher and the Subscriber
- 1_AdditionalSubscriber.bat - For multiple scribers testing, you can open this bat file to open multiple instances of subscribers
- 2_AdditionalPublisher.bat - To launch multiple publishers, you can use this bat file
When 0_Launcher.bat
is launched, it will open a Windows form application that will host services for subscribers and publishers. The window form will remain open and different messages will be displayed as different operations are performed. When you launch this first time, it might ask you for permissions based on your OS.
PubSubServer is the centeral component of this solution. There is one way communication between Publisher and the PubSubServer, Publisher can only publish messages over to PubSubServer where each message is tagged with a topic.
There is two way communication between Subscriber and the PubSubServer, a subscriber can subscriber/un-subscriber a topic with the PubSubServer and PubSubServer will send the message based on topic as sent from Publishers.
You can launch one PubSubServer at a time
By default one Publisher will be opened but you can open multiple Publishers too in order to fully test the functionality.
From each Pubsliher application, you can send messages based on a Topic. Publisher does not have any knowledge about the subscribers, it will just send the message with the topic over to PubSubServer.
You can launch multiple publishers
By default one Subscriber will be opened but you can open multiple Subscribers too in order to fully test the functionality.
On the Subscriber application, you can subscribe to a topic. Once topic is subscribed, the subscriber will be in ready state to receive messages for the subscribed topic. You can unscriber and subscribe to a different topic too.
You can launch multiple subscribers
You can review the overall documentation about project details on the following url: https://github.com/devsitecore/PubSubServerExercise/wiki