Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Fedora generates event messages when a resource is created, updated or deleted. The messages are composed for headers and body. ActivityStreams JSON is now used for message bodies of transmitted events.
The new ActivityStreams based JSON-LD uses proper actor values for emitted messages.Fedora generates event messages when a resource is created, updated or deleted.
The messages are composed for headers and body.

Message Headers

HeaderDescriptionValuesSample Value
org.fcrepo.jms.user
The Fedora user who made the change.
bypassAdmin
org.fcrepo.jms.eventID
A UUID associated with the event

urn:uuid:2096784f-8915-4f76-9114-10f516553554

org.fcrepo.jms.identifier
The identifier portion of the URI of the changed resource
/test1
org.fcrepo.jms.timestamp
Timestamp in epoch time (milliseconds since January 1st, 1970)

1524580811763

org.fcrepo.jms.baseURL
The base portion of the identifiers URI.
http://localhost:8080/rest
org.fcrepo.jms.resourceType
A comma separated list of URIs identifying the types that describe the resource that changed.

http://www.w3.org/ns/ldp#Container,

http://fedora.info/definitions/v4/repository#Resource,

http://fedora.info/definitions/v4/repository#Container,

http://www.w3.org/ns/ldp#RDFSource,

http://www.w3.org/ns/ldp#BasicContainer


org.fcrepo.jms.eventType
A comma separated list of URIs identifying the event types that describe the resource that changed.

https://www.w3.org/ns/activitystreams#Create,

https://www.w3.org/ns/activitystreams#Update,

https://www.w3.org/ns/activitystreams#Delete

https://www.w3.org/ns/activitystreams#Create,

https://www.w3.org/ns/activitystreams#Update


org.fcrepo.jms.userAgent
The type of client user agent that was used to effect the change to the resource.

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36

Notifications Events:

For every resource whose state is changed as a result of an HTTP operation, there must be a corresponding notification made available describing that change.

Examples

Message Body

The format of the body is JSON-LD.  

Below is an example of a message emitted on resource creation.

Code Block
{
	"id": "urn:uuid:2096784f-8915-4f76-9114-10f516553554",
	"type": ["Create", "Update"],
	"name": "create resource, update resource",
	"published": "2018-04-24T14:40:11.763Z",
	"actor": [{
		"type": ["Person"],
		"id": "info:fedora/local-user#bypassAdmin"
	}, {
		"type": ["Application"],
		"name": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36"
	}],
	
Code Block
titleA minimal notification
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "urn:uuid:3c834a8f-5638-4412-aa4b-35ea80416a18",
  "type": "Create",
  "name": "Resource Creation",
  "actor": "http://example.org/agent/fedoraAdmin",
  "object": {
		"type": ["http://www.w3.org/ns/ldp#Container", "http://fedora.info/definitions/v4/repository#Resource",  "id":"http://fedora.info/definitions/v4/repository#Container", "http://www.w3.org/ns/ldp#RDFSource", "http://examplewww.w3.org/fcrepo/rest/resource/path",
    "type": [
      "ldp:Container",
      "ldp:RDFSource"
    ]
  }
}
Code Block
titleA basic notification with some additional detail
{
  /ns/ldp#BasicContainer", "http://www.w3.org/ns/prov#Entity"],
		"id": "http://localhost:8080/rest/test1",
		"isPartOf": "http://localhost:8080/rest"
	},
	"@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "isPartOf		"prov": {
        "@id"http://www.w3.org/ns/prov#",
		"dcterms": "http://purl.org/dc/terms/isPartOf",
		"type": "@type",
		"id": "@id",
		"isPartOf":      {
			"@id": "dcterms:isPartOf",
			"@type": "@id"
      		}
    	}
  ],
  ]
}

Below is an example of a message emitted on resource update. 

Code Block
{
	"id": "urn:uuid:be29ae69bb42dbbc-2134c8d1-f1b04b6d-34beb56d-2f91b6d1f02939193b299b11",
  	"type": ["Update"],
  	"name": "Resourceupdate Modificationresource",
  	"published": "20162018-0704-04T1324T14:4640:39Z11.763Z",
	"actor": [{
		"type": "inbox["Person"],
		"id": "httpinfo://example.org/ldn/inbox/path",
  "actorfedora/local-user#bypassAdmin"
	}, {
		"type": ["Application"],
		"name": "Mozilla/5.0 (Macintosh; Intel Mac OS  {
      "id": "#actor0",
      "type": "Person",
      "name": "fedo raAdmin"
    },
    {
      "id": "#actor1",
      "type": "Service",
      "name": "APIX-core/0.1"
    }
  ],
  "object": {
    "id": "http://example.org/fcrepo/rest/resource/path",
    "updated": "2016-07-04T13X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36"
	}],
	"object": {
		"type": ["http://www.w3.org/ns/ldp#Container", "http://fedora.info/definitions/v4/repository#Resource", "http://fedora.info/definitions/v4/repository#Container", "http://www.w3.org/ns/ldp#RDFSource", "http://fedora.info/definitions/v4/repository#RepositoryRoot", "http://www.w3.org/ns/ldp#BasicContainer", "http://www.w3.org/ns/prov#Entity"],
		"id": "http://localhost:8080/rest",
		"isPartOf": "http://localhost:8080/rest"
	},
	"@context": ["https://www.w3.org/ns/activitystreams", {
		"prov": "http://www.w3.org/ns/prov#",
		"dcterms": "http://purl.org/dc/terms/",
		"type": "@type",
		"id": "@id",
		"isPartOf": {
			"@id": "dcterms:isPartOf",
			"@type": "@id"
		}
	}]
}

Below is an example of a message emitted on resource deletion.

Code Block
{
	"id": "urn:uuid:31410238-7a73-4014-a457-1b6d7df5adac",
	"type": ["Delete"],
	"name": "delete resource",
	"published": "2018-04-24T17:51:15.968Z",
	"actor": [{
		"type": ["Person"],
		"id": "info:fedora/local-user#bypassAdmin"
	}, {
		"type": ["Application"],
		"name": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36"
	}],
	"object": {
		"type": ["http://www.w3.org/ns/ldp#Container", "http://fedora.info/definitions/v4/repository#Resource", "http://fedora.info/definitions/v4/repository#Container", "http://www.w3.org/ns/ldp#RDFSource", "http://www.w3.org/ns/ldp#BasicContainer", "http://www.w3.org/ns/prov#Entity"],
		"id": "http://localhost:8080/rest/test1",
		"isPartOf": "http://localhost:8080/rest"
	},
	"@context": ["https://www.w3.org/ns/activitystreams", {
		"prov": "http://www.w3.org/ns/prov#",
		"dcterms:44:39Z",
    "type": [
      "ldp:Container",
      "ldp:RDFSource",
      "http://example.org/type/CustomType"
    ],
    "isPartOf": "http://examplepurl.org/fcrepodc/restterms/",
		"type": "@type",
		"id": "@id",
		"isPartOf": {
			"@id": "dcterms:isPartOf",
			"@type": "@id"
		}
	}]
}