Skip to content

Notifications

Aaron Coburn edited this page May 26, 2020 · 7 revisions

When Trellis resources are created, modified or deleted, a notification is made available, describing the change. One purpose of this feature is to support external integrations, such as indexing content in a triple store or search engine.

These notifications are serialized as JSON-LD and conform to the W3C Activity Streams specification. Any consumer of these notifications should be capable of reading this format.

For example, a modification event might look like this:

{
  "@context": "https://www.w3.org/ns/activitystreams",   
  "id": "urn:uuid:031b0857-b1bd-4f19-989d-1ab0e22ca57c",
  "type": ["Update" , "http://www.w3.org/ns/prov#Activity"],
  "actor": ["https://people.apache.org/~acoburn"],
  "object": {
    "id": "http://localhost:8080/container/",
    "type": ["http://www.w3.org/ns/ldp#Container"]
  }
}

And a creation event might look like this:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "urn:uuid:e5297053-52fd-4bed-a840-7ef2ba94f7de",
  "type": ["Create", "http://www.w3.org/ns/prov#Activity"],
  "actor": ["http://www.trellisldp.org/ns/trellis#AnonymousAgent"],
  "object": {
    "id": "http://localhost:8080/container/a290e05a-c09e-4f10-bd0b-3dbcba425e77",
    "type": ["http://www.w3.org/ns/ldp#RDFSource"]
  }
}

Finally, this is an example of a delete event:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "urn:uuid:d7a418b8-151b-43dc-b5a9-ba1cd5d6f2aa",
  "type": ["Delete","http://www.w3.org/ns/prov#Activity"],
  "actor":["http://www.trellisldp.org/ns/trellis#AdministratorAgent"],
  "object": {
    "id": "http://localhost:8080/container/ef29cb34-f112-433b-b944-9eaab268ebac",
    "type": ["http://www.w3.org/ns/ldp#NonRDFSource"]
  }
}

Using Apache Camel

The Apache Camel project makes writing and managing asynchronous external integrations considerably easier. The camel-ldp project provides a collection of processors to make the existing camel-http component easy to use with LDP servers.

Clone this wiki locally