...
LDPath Transformations
If an fcr:transform
program has been installed as "mytransform
", you can generate a JSON representation of an object and send it to a low-latency, highly available caching layerdocument store, such as Riak:
Code Block | ||
---|---|---|
| ||
"activemq:topic:fedora" ==> { to("fcrepo:localhost:8080/fedora/rest") filter(xpathFilter) { to("fcrepo:localhost:8080/fedora/rest?accept=application/json&transform=mytransform") setHeader(Exchange.HTTP_METHOD, constant("PUT") process((exchange: Exchange) => { exchange.getIn.setHeader( Exchange.HTTP_PATH, "/buckets/fcrepo/keys/" + URLEncoder.encode(exchange.getIn.getHeader("org.fcrepo.jms.identifier", classOf[String])) ) }) to("http4:localhost:8098") } } |
External Triplestore
Some additional processing must be done to transform an application/n-triples
response into a valid application/sparql-update
payload before sending to Fuseki or Sesame. The fcrepo component contains some processors in org.fcrepo.camel.processor
to handle this case.
Code Block | ||
---|---|---|
| ||
from("activemq:topic:fedora")
.to("fcrepo:localhost:8080/fedora/rest?accept=application/n-triples")
.process(new SparqlUpdateProcessor())
.setHeader(Exchange.CONTENT_TYPE).constant("application/sparql-update")
.to("http4:localhost:3030/fcrepo/update"); |
Supporting Queues
The default configuration is fine for locally-deployed listeners, but it can be problematic in a distributed context. For instance, if the listener is restarted while a message is sent to the topic, that message may be missed. Furthermore, if there is a networking hiccup between fedora's local broker and the remote listener, that too can result in lost messages. Instead, in this case, a queue may be better suited.
...