Versions Compared

Key

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

...

Please note that the hostnames used for Fedora and Solr in the snippets above are arbitrary. It is quite likely that these systems will be deployed on separate hosts and that the Camel routes will be deployed on yet another host. Camel makes it easy to distribute applications and replicate data asynchronously across an arbitrarily large number of independent systems.

Message Headers

By default, Fedora publishes events to a topic on a local broker. This topic is named "fedora". Each message will contain an empty body and up to five different header values. Those header values are namespaced so they look like this:

...

The  properties  field will list the RDF properties that changed with that event.  NODE_REMOVED  events contain no properties. The fcrepo component for Camel is configured to recognize these headers and act appropriately.

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.

ActiveMQ supports “virtual destinations”, allowing your broker to automatically forward messages from one location to another. If Fedora4 is deployed in Tomcat, the ActiveMQ configuration will be located in WEB-INF/classes/config/activemq.xml. That file can be edited to include the following block:


 

Code Block
languagexml
titleactivemq.xml customization: supporting a queue/fedora endpoint
linenumberstrue
<destinationInterceptors>
  <virtualDestinationInterceptor>
    <virtualDestinations>
      <compositeTopic name="fedora">
        <forwardTo>
          <queue physicalName="fedora"/>
        </forwardTo>
      </compositeTopic>
    </virtualDestinations>
  </virtualDestinationInterceptor>
</destinationInterceptors>

Now a consumer can pull messages from a queue without risk of losing messages.

This configuration, however, will not allow any other applications to read from the original topic. If it is necessary to have /topic/fedora available to consumers, this configuration will be useful:

Code Block
languagexml
titleactivemq.xml customization: supporting topic and queue endpoints
linenumberstrue
<destinationInterceptors>
  <virtualDestinationInterceptor>
    <virtualDestinations>
      <compositeTopic name="fedora" forwardOnly="false">
        <forwardTo>
          <queue physicalName="fedora"/>
        </forwardTo>
      </compositeTopic>
    </virtualDestinations>
  </virtualDestinationInterceptor>
</destinationInterceptors>

Now, both /topic/fedora and /queue/fedora will be available to consumers.

Distributed Brokers

The above example will allow you to distribute the message consumers across multiple machines without missing messages, but it can also be useful to distribute the message broker across multiple machines. This can be especially useful if you want to further decouple the message producers and consumers. It can also be useful for high-availability and failover support.

ActiveMQ supports a variety of distributed broker topologies. To push messages from both the message queue and topic to a remote broker, this configuration can be used:

Code Block
languagexml
titleactivemq.xml customization: distributed brokers
linenumberstrue
<networkConnectors>
  <networkConnector name="fedora_bridge" dynamicOnly="true" uri="static:(tcp://remote-host:61616)">
    <dynamicallyIncludedDestinations>
      <topic physicalName="fedora"/>
      <queue physicalName="fedora"/>
    </dynamicallyIncludedDestinations>
  </networkConnector>
</networkConnectors>

Protocol Support

ActiveMQ brokers support a wide variety of protocols. If Fedora's internal broker is bridged to an external broker, please remember to enable the proper protocols on the remote broker. This can be done like so:

...


Each transportConnector supports many additional options that can be added to this configuration.

Deployment

Camel routes can be deployed in any JVM container. In order to deploy to Jetty or Tomcat, the route must be built as a WAR file. This command will get you started:

...

  1. downloading Karaf 4.x or later from an apache.org mirror
  2. running ./bin/karaf to enter the shell
  3. installing required bundles:

    Code Block
    languagebash
    titleKaraf console
    $> feature:repo-add camel 2.16.2
    $> feature:repo-add activemq 5.11.1
    $> feature:install camel
    $> feature:install activemq-camel
    
    # display available camel features
    $> feature:list | grep camel
    
    # install camel features, as needed
    $> feature:install camel-http4
     
    # install fcrepo-camel (as of v4.4.0)
    $> feature:repo-add mvn:org.fcrepo.camel/fcrepo-camel/4.4.0/xml/features
    $> feature:install fcrepo-camel


  4. setting up a service wrapper (so that karaf runs as a system-level service)

    Code Block
    languagebash
    titleKaraf console
    $> feature:install wrapper
    $> wrapper:install


  5. following the directions provided by this command

Now, routes can be deployed (and re-deployed) by simply copying JAR files or XML documents to $KARAF_HOME/deploy.

Fedora Camel Toolbox

The Fedora project distributes camel routes for several common repository tasks as part of the fcrepo-camel-toolbox project, for use with Karaf version 4.x. Additional information is available on the Integration Services page. Detailed installation instructions are available as part of the project README and follow this pattern:

Code Block
languagebash
titleKaraf Shell
# install fcrepo-camel-toolbox (as of v4.1.0)
$> feature:repo-add mvn:org.fcrepo.camel/fcrepo-camel-toolbox/4.1.0/xml/features
 
# install fcrepo-camel-toolbox (as of v4.5.0)
$> feature:repo-add mvn:org.fcrepo.camel/toolbox-features/4.5.0/xml/features
 
# display available features
$> feature:list | grep fcrepo
 
# install feature
$> feature:install fcrepo-indexing-triplestore

...


Monitoring Your Camel Routes

It is often useful to keep runtime statistics for your camel routes. Hawtio is a web console for monitoring your messaging infrastructure, and it can be deployed in any JVM container, including Karaf, Tomcat or Jetty.

...

With Tomcat or Jetty, deploying hawtio is simply a matter of installing a WAR file. Please see the hawtio website for more information.