Skip to content

Notification system (Publisher subscriber example)

Notifications You must be signed in to change notification settings

Frederick-Wordie/Notification_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Notification_System

Notification system (Publisher subscriber example)

This project is made up of two applications, a publisher and a subscriber. The publisher is a server that keeps track of topics -> subscribers where a topic is a string and a subscriber is an HTTP endpoint. When a message is published on a topic, it is forwarded to all subscriber endpoints. The publisher runs on port 8000 A user interface has been created. On load it initiates a javascript event publishing to publish events to a topic. (http://localhost:8000/)

Clone and Run project as spring boot project

Publisher server end points

  1. To Create a Subscription

POST /subscribe/{topic}

Request:

Example

{
	"url": "http://localhost:9000/test1",     		
 }

Response:

{
   
    "url": "http://localhost:9000/test1",
    "topic": "String"
}
  1. Publish message to topic

POST /publish/{topic}

Request:

Example

{
	[key: String]: any,     		
 }

Response: HTTP response code

Automated sending of messages to a topic can be iniitiated using javascript by visting http:localhost:8000/ in your browser

  1. Payload sent to subscribers

Request:

Example

{
  "topic": "String",  
  "data": "object"
 }

Subscribing server end points

The applicaton runs on port 9000. It has an end point to receive the sent data and also a GET end point to monitor the events being sent. This is done using Server sent event. The message is streamed unto the web page using event source in javascript

  1. End points to receive published events

POST /test1 and POST /test2

Received data structure:

Example

{
	"topic": "String"
	"data": "object",     		
 }

Response: HTTP response code

Visit http:localhost:9000/ in your browser to see the events being sent

About

Notification system (Publisher subscriber example)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published