Before running the server, ensure you have the following:
- Java Development Kit (JDK) installed.
-
You have to clone this project
-
Goto
src
folder locationcd ./Simple-Pub-Sub/src
-
You have to compile
Server.java
filejavac Server.java
-
Run Server
java Server 5000
-
Using another terminal compile
Client.java
filejavac Client.java
-
Run Client (Using several terminals you can up several clients with topics below commands)
- Run
PUBLISHER
java Client 127.0.0.1 5000 PUBLISHER TOPIC
- Run
SUBSCRIBER
Messages from publishers are sent to subscribers who are listening to the publisher's topic.java Client 127.0.0.1 5000 SUBSCRIBER TOPIC
- Run