This is publish subscribe system (PubSub) that uses two forms of communication: basic messages using UDP and Java RMI for publishing and subsscribing. The PubSub system will allow the publishing of simple formatted “articles”.
Steps:
-
Install pom:
mvn install -
Compile:
mvn compile -
Create package:
mvn package- This will create tar distribution in
dist/target/
- This will create tar distribution in
-
Generate eclipse project files:
mvn eclipse:eclipse- This project can be now imported in eclipse.
- To start RMI registry on server host you need to set the
CLASSPATHfirst. - The classpath should include the path of the
jarthat contains theCommunicateinterface and thePubSubService\_Stub. This is thecommonandserverjar. - Eg.
export CLASSPATH="/home/prashant/workspace/PubSub/common/target/common-1.0-SNAPSHOT.jar:/home/prashant/workspace/PubSub/server/target/server-1.0-SNAPSHOT.jar" - Run
rmiregistrynow.
- Create a security policy file.
- Eg security.policy. Contents of this file:
grant { // Allow everything for now permission java.security.AllPermission; };
- Go to the pubsub-1.0-SNAPSHOT/:
cd dist/target/pubsub-1.0-SNAPSHOT/ - Run:
java -Djava.security.policy="<SECURITY POLICY FILE>" -cp ./client-1.0-SNAPSHOT.jar:./server-1.0-SNAPSHOT.jar:./common-1.0-SNAPSHOT.jar edu.umn.pubsub.client.Client <IP ADDRESS OF THE SERVER> <IP_ADDR_OF_UDP_CLIENT> <UDP_CLIENT_PORT> - This will give you the client command line prompt.
- Go to the pubsub-1.0-SNAPSHOT/:
cd dist/target/pubsub-1.0-SNAPSHOT/ - Run:
java -Djava.security.policy="<SECURITY POLICY FILE>" -cp ./client-1.0-SNAPSHOT.jar:./server-1.0-SNAPSHOT.jar:./common-1.0-SNAPSHOT.jar edu.umn.pubsub.server.Server <IP ADDRESS OF THE SERVER>