-
Notifications
You must be signed in to change notification settings - Fork 3
The Publisher
The Publisher is a simple HTTP server that delivers a change notification to the Hub. The publisher accepts the notification payload in the body of an HTTP POST request and delivers the payload to the Hub, again using HTTP POST.
Using a REST API makes ResourceSync PuSH independent of programming languages and easy to integrate for existing implementations. A Source that wishes to notify it's subscribers of a change, simply needs to create the change notification according to the ResourceSync notification specification, and send the XML to the publisher using HTTP POST. A complete example is shown below in one simple curl
command.
curl \
-X POST \
-H 'content-type: application/xml' \
-d '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:rs="http://www.openarchives.org/rs/terms/">
<url>
<loc>http://example.com/res2.pdf</loc>
<lastmod>2013-01-02T13:00:00Z</lastmod>
<rs:md change="updated"/>
</url>
</urlset>' \
http://resourcesync.org/publisher
The publisher, upon receiving the request above, verifies if the body is of mimetype application/xml
, and then prepares to send the payload to the hub. For this to happen, the publisher requires information about which hub to deliver the payload to and where it is located. This information can be provided in the configuration file resourcesync_push.ini
.
The Publisher section in the resourcesync_push.ini
has the following parameters:
-
url
: [required] The complete HTTP URL of the publisher itself. -
hub_url
: [required] The hub's HTTP URL to publish the change notifications to. -
topic_url
: [required] The topic HTTP URL of the notification. See the ResourceSync notification specification for more information. -
server_path
: [optional] If the publisher is set up using a proxy server, the proxy path that is used must be specified here.