Rest – Publish / Subscribe via HTTP Callbacks

callbacksdesignhttppubsubrest

My team is tasked with creating a publish/subscribe system for incoming REST messages. 99% of the time, this system will be used for notifications between different processes on the same cpu, but we will need to support notification over the network as well.

We are considering a REST based model, where a client subscribes with a POST like:

curl https://brokeripaddress/REST/function/path/subscribe -H 'Content-Type: application/json' -d '{"subscription-ip-address":"192.168.1.1", "subscription-method-filter":"*"}' -X POST

Then, when our REST service receives any call to /REST/function/path, we would clone that request, sending it to the specified subscription ip address.

Does anyone have experience with similar patterns? Is this a reasonable way to implement publish/subscribe, or are there obvious pitfalls we are missing?

Best Answer

Have a look at WebHooks for an approach example :

A web application implementing WebHooks will POST a message to a URL when certain things happen.

Related Topic